metsw24-max commented on PR #49883:
URL: https://github.com/apache/arrow/pull/49883#issuecomment-5725823000

   @pitrou fair point. Those were defensive only: as far as I can see the JSON 
parser only ever passes single values or non-negative row counts into these 
builders, so a negative argument is a caller bug rather than something 
untrusted input can drive.
   
   I've dropped all the negative argument checks from `BufferBuilder` and both 
`TypedBufferBuilder` variants, along with their tests, so the header now only 
carries the `AddWithOverflow` / `MultiplyWithOverflow` checks. That includes 
the bool `Resize` / `FinishWithLength` ones @tadeja suggested earlier, removed 
for consistency. The negative capacity check in `PoolBuffer::Reserve` / 
`Resize` already exists on main and is unchanged, it's just routed through 
`ValidateBufferCapacity` now.
   
   The overflow test also covers the `size_ + length` path in `Reserve` / 
`Append` now, and I've updated the PR description to match the reduced scope. 
Buffer tests pass locally.


-- 
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]

Reply via email to