iemejia opened a new pull request, #3842:
URL: https://github.com/apache/avro/pull/3842

   ## Summary
   
   Fix undefined behavior in `read_array_value()` and `read_map_value()` in 
`lang/c/src/value-read.c` where negation of `block_count` via multiplication by 
`-1` overflows for values not representable after negation.
   
   ## Changes
   
   - Replace `block_count = block_count * -1` with the overflow-safe 
`-(block_count + 1) + 1` idiom (consistent with the C++ fix in AVRO-4228)
   - Add a guard rejecting invalid (non-positive) results after negation
   - Add `test_avro_4275` covering the overflow case and verifying legitimate 
negative block counts still decode correctly
   
   ## Testing
   
   All existing C SDK tests pass. New test passes under valgrind memcheck with 
no leaks.


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