rootvector2 commented on PR #2942:
URL: https://github.com/apache/tika/pull/2942#issuecomment-4956254355

   looks right to me. the `(long)` cast on the top byte closes the gap #2887 
left: masking fixed per-byte sign extension, but the `<< 24` still ran in int 
arithmetic, so a uint32 >= 2^31 went negative on the widen to `dest`. the 
encint fix checks out too, the old inline decoder compared a signed byte to 
`0x80`, which is never true, so it always stopped after one byte.
   
   one small note: now that `unmarshalUInt32` can't return negative, the 
`getBlockCount() < 0` fallback in `enumerateBlockAddresses` is dead code, and 
an all-`0xff` block count (the old `-1` sentinel that `TestParameters` 
documented) takes the 5000 cap with a zero-padded tail instead of deriving the 
count from the remaining data. might be worth an `== 0xFFFFFFFFL` check to keep 
that path, though the `Math.min(count, rem)` guard means nothing unsafe happens 
either way.


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