Sealdot opened a new pull request, #562: URL: https://github.com/apache/arrow-js/pull/562
Closes #556. The IPC reader never compared the value offsets of a variable-width column with its data buffer, or with each other. An offset past the end of the data read the padding bytes after it, and an offset below the one before it made two values overlap: `getVariableWidthBytes()` calls `subarray(x, y)`, which clamps the end and returns an empty value when `y < x`. Both reads gave corrupt values with no error; Arrow C++ refuses both arrays in `Array::ValidateFull()`. `VectorLoader` now checks the offsets of `Utf8`, `LargeUtf8`, `Binary`, and `LargeBinary` columns when loading a record batch. It throws when the buffer holds fewer than `length + 1` offsets, when the first offset is negative, when an offset is below the one before it, or when the last offset is past the data buffer's length. A first offset above zero stays valid, since a sliced array keeps offsets into its original buffer. This applies to the stream and file readers, compressed batches, and the JSON loader, which share the same visitors. Nested `List`/`Map` offsets index child vectors rather than a data buffer and are out of scope here. The regression tests patch one value offset inside otherwise valid streams and files written by the real writers — a last offset 8 bytes past the data buffer, an offset below its predecessor, and a negative first offset now raise an error, while empty strings (repeated offsets) and unmodified bytes still read correctly. The open PR #551 validates buffer regions against the message body and does not cover this fault: these offsets are inside their own buffer. All 3,012 IPC tests across 19 suites passed on `main` (`7a34e681`), along with the ESNext ESM source typecheck and ESLint on both changed files. A full local Jest run was not attempted; on the same machine the suite previously reached its 640 MiB Node heap limit. Upstream CI workflows await maintainer approval and have not run. Cognition Devin CLI agent (SWE-2 High) assisted with the implementation, tests, and verification. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
