Repository navigation
Description
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
We keep finding realistic integer-overflow bugs one callsite at a time. Recent examples include Parquet byte-array offsets (#12179 and #12215), MapBuilder offsets (#12052), FixedSizeList validation (#11859), and CSV allocation sizing (#9886).
These bugs tend to have the same shape: a length, offset, count, or allocation size derived from input is combined with unchecked + or *; overflow then bypasses a bounds check, panics, requests the wrong allocation, or violates an unsafe precondition. They are especially easy to miss on 64-bit development machines when the failure is reachable on supported 32-bit targets.
Fixing only the reported expression leaves sibling paths with the same problem and produces a stream of very small follow-up PRs. We should audit the realistic overflow boundaries once and fix them in coordinated batches.
Describe the solution you'd like
Audit arithmetic involving user-controlled or format-controlled lengths, offsets, counts, and capacities, focusing on:
- parsing and decoding Parquet, IPC, CSV, JSON, and Avro input;
- arithmetic used before slicing, unchecked indexing, pointer arithmetic, or buffer writes;
- allocation and reserve sizes such as
count * element_sizeandoffset + length; - builders and kernels that produce
i32/u32offsets, dictionary keys, run ends, or other narrow physical values; - code whose correctness differs between 32-bit and 64-bit targets.
Use checked_add, checked_mul, checked_sub, or checked conversions where overflow is reachable, and return the existing crate error before allocation, mutation, or unsafe access. Add boundary tests that fail without the check, including a 32-bit-target test when 64-bit arithmetic cannot reproduce the overflow.
This should not be a mechanical replacement of every arithmetic operator. Loop counters and other arithmetic already bounded by a clear invariant should remain simple, and numeric kernels with documented wrapping, saturating, or overflow semantics are out of scope.
To avoid another flood of single-callsite PRs, contributors should claim a crate or subsystem, inspect sibling implementations and wrapper paths, and submit one coherent patch for that area. The issue can track the audited areas and any expressions that are intentionally left unchecked with their invariant.
Audit checklist
Check a leaf item only after its realistic candidates have been fixed or documented as safe. Check the crate when all of its leaf items are complete.
Core Arrow crates
-
arrow- Array facade and re-exports (
array) - Compute facade and dispatch (
compute) - Datatype facade (
datatypes) - Utilities (
util)
- Array facade and re-exports (
-
arrow-arith- Aggregates (
aggregate) - Arithmetic, arity, and numeric kernels (
arithmetic,arity,numeric) - Bitwise and boolean kernels (
bitwise,boolean) - Temporal kernels (
temporal)
- Aggregates (
-
arrow-array- Array implementations (
array) - Builders (
builder) - Record batches and array readers (
record_batch,array_reader) - Iterators, run arrays, and delta handling (
iterator,run_iterator,delta) - Temporal conversions and timezones (
temporal_conversions,timezone) - FFI and stream interfaces (
ffi,ffi_stream)
- Array implementations (
-
arrow-buffer- Allocation and memory pools (
alloc,pool) - Buffers and builders (
buffer,builder) - Bit and bitmap utilities (
util) - Native values and byte conversions (
native,bytes) - Arithmetic, bigint, and interval helpers (
arith,bigint,interval)
- Allocation and memory pools (
-
arrow-data-
ArrayDataconstruction and validation (data) - Mutable transforms (
transform) - ByteView layout and validation (
byte_view) - Equality and decimal handling (
equal,decimal) - FFI (
ffi)
-
-
arrow-schema- Datatype parsing and display (
datatype,datatype_parse,datatype_display) - Fields and schemas (
field,fields,schema) - Extensions and metadata (
extension,metadata) - FFI (
ffi)
- Datatype parsing and display (
Compute crates
-
arrow-cast- Cast kernels and nested/dictionary dispatch (
cast) - Parsing and local-time conversion (
parse,local_time) - Display and pretty formatting (
display,pretty) - Base64 conversion (
base64)
- Cast kernels and nested/dictionary dispatch (
-
arrow-cmp- Comparison kernels and type dispatch
-
arrow-ord- Comparators and ordering (
cmp,comparison,ord) - Sorting and partitioning (
sort,partition) - Ranking (
rank)
- Comparators and ordering (
-
arrow-row- Fixed-width row encoding (
fixed) - Variable-width row encoding (
variable) - List row encoding (
list) - Run-end encoded rows (
run)
- Fixed-width row encoding (
-
arrow-select- Filter and take (
filter,take) - Concat and interleave (
concat,interleave) - Merge, zip, and window (
merge,zip,window) - Coalescing (
coalesce) - Dictionary handling (
dictionary) - Null and union helpers (
nullif,union_extract)
- Filter and take (
-
arrow-string- Length, substring, and concatenation (
length,substring,concat_elements) - LIKE and regular expressions (
like,binary_like,regexp) - String and binary predicates (
predicate,binary_predicate)
- Length, substring, and concatenation (
Format and transport crates
-
arrow-avro- Readers, including async readers (
reader) - Writers (
writer) - Schema, codec, and compression (
schema,codec,compression)
- Readers, including async readers (
-
arrow-csv- Reader and record decoder (
reader) - Writer (
writer)
- Reader and record decoder (
-
arrow-json- Readers and decoders (
reader) - Writers and encoders (
writer)
- Readers and decoders (
-
arrow-ipc- File and stream readers (
reader) - File and stream writers (
writer) - Compression and decompression (
compression) - Schema and FlatBuffer conversion (
convert)
- File and stream readers (
-
arrow-flight- Encoding, decoding, and streams (
encode,decode,streams) - Client and SQL support (
client,sql) - Utilities, errors, and trailers (
utils,error,trailers)
- Encoding, decoding, and streams (
-
arrow-flight/gen- Generated binding boundaries and conversions (do not hand-edit generated code)
Parquet crates
-
parquet- Arrow array readers and decoders (
arrow/array_reader,arrow/decoder,arrow/record_reader) - Arrow reader orchestration and selection (
arrow/arrow_reader,arrow/async_reader) - Arrow writers and buffers (
arrow/arrow_writer,arrow/async_writer,arrow/buffer) - Arrow schema conversion and push decoding (
arrow/schema,arrow/push_decoder) - Column readers and writers (
column/reader,column/writer,column/chunker) - Encoding and decoding (
encodings/encoding,encodings/decoding) - File pages, metadata, and page indexes (
file,file/metadata,file/page_index) - Compression and physical datatypes (
compression,data_type,basic) - Schemas and records (
schema,record) - Bloom filters, encryption, and geospatial paths (
bloom_filter,encryption,geospatial) - Variant integration and utilities (
variant,util)
- Arrow array readers and decoders (
-
parquet-geospatial- Bounding boxes and intervals (
bounding,interval) - Geospatial types (
types)
- Bounding boxes and intervals (
-
parquet-variant- Builders (
builder) - Decoder and variant access (
decoder,variant) - Paths and utilities (
path,utils)
- Builders (
-
parquet-variant-compute- Arrow/Variant conversion (
arrow_to_variant,variant_to_arrow,type_conversion) - Array builders and casts (
variant_array,variant_array_builder,cast_to_variant) - Shredding and unshredding (
shred_variant,unshred_variant) - Variant access and JSON conversion (
variant_get,from_json,to_json)
- Arrow/Variant conversion (
-
parquet-variant-json- JSON parsing (
from_json) - JSON serialization (
to_json)
- JSON parsing (
-
parquet_derive- Derive input parsing and generated field code (
parquet_field)
- Derive input parsing and generated field code (
-
parquet_derive_test- Generated-code boundary tests
Interop and support crates
-
arrow-integration-test- Datatype, field, and schema conversion
-
arrow-integration-testing- JSON integration helpers and validators
-
arrow-pyarrow- PyArrow FFI conversion boundaries
Acceptance criteria
- Relevant crates and subsystems have been inventoried and tracked here.
- Each candidate is fixed or documented as safe because of a concrete dominating bound.
- Fixes cover sibling and wrapper paths, not only the originally reported expression.
- Fallible paths report an error before partial mutation or unsafe access.
- Applicable overflow boundaries have regression tests, including 32-bit coverage where needed.
Open issues expected to be resolved by this audit
This list contains open issues whose root cause is directly within the audit scope. Closing this audit should also close each of these issues.
- parquet: DELTA_LENGTH_BYTE_ARRAY decoder panics on a negative length instead of returning an error #12290: reject negative DELTA_LENGTH_BYTE_ARRAY lengths before casting or adding them
- Parquet reader panics on a BYTE_ARRAY decimal with redundant sign-extension bytes #12287: handle oversized BYTE_ARRAY decimal representations without panicking
-
FixedSizeBinaryBuilder::append_valueaccepts values whose length differs fromvalue_lengthby a multiple of 2^32 #12285: avoid truncatingFixedSizeBinaryBuilderinput lengths throughas i32 - parquet: GZip/Brotli page decompression is not bounded by the page's uncompressed size #12181: bound GZip and Brotli page decompression by the declared uncompressed size
- parquet:
read_vlqaccepts varints longer than 10 bytes and wraps the value #12099: reject overlong Thrift varints instead of wrapping their shifts - replace more mutablebuffer callsites with fallible methods #11900: replace panicking
MutableBufferallocation callsites inside fallible APIs - BatchCoalescer should flush before exceeding 32-bit offset limits #11869: flush
BatchCoalescerbefore cumulative offsets exceed their physical type -
interleavepanics on list views of dictionaries whose combined values overflow the key type #11620: make ListView dictionary interleave handle key-capacity overflow without panicking -
multiply_fixed_pointreturns wrong values or panics when the required scale is more than 76 below the product scale #11605: prevent scale arithmetic and power computation from overflowing inmultiply_fixed_point - Parquet: Mask row selection strategy decodes unbounded rows per batch, failing with "index overflow decoding byte array" #11478: bound Parquet Mask decoding before variable-width offsets overflow
- variant_get converts integers to decimals without consistently checking target precision #11309: check target decimal precision consistently in Variant integer conversions
- Out-of-bounds index in the BYTE_STREAM_SPLIT decoder on a malformed page header #11121: validate BYTE_STREAM_SPLIT counts before index arithmetic can leave the page buffer
- Casting decimals that exceed declared precision is buggy #10947: make decimal casts report unrepresentable values instead of panicking or wrapping
- Casting decimal -> decimal with large scale is buggy #10946: check decimal rescaling multiplication instead of returning wrapped values
- Dictionary values are not merged for view types, and the merge interner can overflow the key type on its own #10925: avoid false dictionary-key overflow while merging view dictionaries and interning values
-
arrow-ipc: a footer block's declared body length is zero-filled before it is read #10921: validate IPC block lengths before addition and allocation -
SerializedPageReaderallocatesuncompressed_page_sizebytes before validating it against the column chunk #10734: validate Parquet page uncompressed sizes before allocation - parquet: panic-on-decode DoS from unchecked Thrift list size in read_thrift_vec (and broader thrift parser hardening) #9874: finish hardening attacker-controlled Thrift list sizes and allocation capacities
- Error when reading row group larger than 2GB (total string length per 8k row batch exceeds 2GB) #7973: split or stage Parquet byte-array output before cumulative 32-bit offsets overflow
- Parquet error: index overflow decoding byte array #7243: avoid artificial byte-array offset overflow while combining dictionary batches
- Check valid byte_range in parquet Column Chunk reading? #6255: validate Parquet column-chunk offsets and lengths instead of asserting or casting them
- Bug(arrow-row): calling
convert_rawfunction cause "offset overflow" panic #6112: handlearrow-rowvariable-width offset overflow without panicking
Activity
Rich-T-kid commentedon Nov 18, 2026
a decent chunk of PR's I see recently are just this, AI is pretty good and dealing with things like this. Will test out
mbutrovich commentedon Nov 18, 2026
Perhaps something you can use https://github.com/mbutrovich/arrow-pbt for? Happy to accept PRs :)
Rich-T-kid commentedon Nov 19, 2026
PR #12340 completes the audit for
arrow-csv,arrow-integration-test,arrow-integration-testing, andarrow-pyarrow. The three newly completed crate entries are now checked off.fix: check small-crate length and offset arithmetic (apache#12340)
Mola-maker commentedon Nov 28, 2026
I'd like to take the
parquet-variantdecoder and variant access section (decoder,variant). I'll audit offset, length and field-id arithmetic on the encoded bytes and send one PR for the section. I'll keep clear of the code #12309 touches.Mola-maker commentedon Nov 28, 2026
Audited the
parquet-variantdecoder and variant access section. All offset, length and field-id arithmetic on encoded bytes is already checked, and crafted boundary inputs through thetry_*APIs return errors without panics, so there is nothing to fix here.