You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fory.apache.org by "Hkwaynewing (via GitHub)" <gi...@apache.org> on 2026/10/06 22:30:02 UTC

[PR] fix(java): advance readerIndex in continueReadBinarySize [fory]

Hkwaynewing opened a new pull request, #4133:
URL: https://github.com/apache/fory/pull/4133

   ## Why?
   The 3/4-byte varint length-prefix fast path of readBinarySize() delegates to continueReadBinarySize(), which decoded the size but never assigned readerIndex, unlike the <=2-byte path. readBytesAndSize() (and readStringAndSize / *WithSize primitive readers) then copied the body from the stale index, i.e. starting at the first prefix byte: payloads with big enough length came back shifted by the prefix width, silently corrupted, or failed downstream with "reserved header bitmap flags" errors.
   
   ## What does this PR do?
   
   Fix both the base and the java25 MemoryBuffer by assigning readerIndex = readIdx in continueReadBinarySize, matching continueReadVarUInt32. Add a regression test covering 3-byte and 4-byte prefixes plus a trailing read to verify index alignment.
   
   The Android path (MemoryOps.readBinarySize -> readVarUInt32) already advances readerIndex correctly and needed no change.
   
   ## Related issues
   
   No related issue found
   


-- 
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: commits-unsubscribe@fory.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org


Re: [PR] fix(java): advance readerIndex in continueReadBinarySize [fory]

Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang merged PR #4133:
URL: https://github.com/apache/fory/pull/4133


-- 
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: commits-unsubscribe@fory.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org