You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Java] Reject negative FieldNode length during deserialization #1421
ArrowFieldNode accepts a negative length without validation. The IPC
(MessageSerializer.deserializeRecordBatch), JSON (JsonFileReader), and C Data
(ArrayImporter) deserialization paths all build ArrowFieldNode instances directly
from externally supplied metadata, so a malformed or hostile input can set a negative
node length.
A negative length is never valid, but today it propagates into buffer-size math in BitVectorHelper.loadValidityBuffer (getValidityBufferSizeFromCount performs an
unsigned shift, turning a small negative into a ~512 MB allocation) and into ArrowBuf.setOne / setZero with a negative byte count. With bounds checking enabled
this surfaces as an exception after a large buffer has already been allocated and the
vector's prior validity buffer released; with bounds checking disabled
(arrow.enable_unsafe_memory_access=true) the negative length reaches Unsafe.setMemory and is reinterpreted as a huge unsigned length.
Expected behavior
Field node length is validated at the point of construction and a negative value is
rejected with a clear IllegalArgumentException before any buffer is sized or written.
Activity
fix(vector): reject negative FieldNode length during deserialization
GH-1462: Check IPC and C Data counts before using them and release me…
jbonofre commentedon Nov 13, 2026
Fixed on
mainby eebc13770c (#1463), which includes the changes from #1422.