pjfanning opened a new pull request, #1391:
URL: https://github.com/apache/poi/pull/1391

   Follow-up to #1387.
   
   [MS-DOC] defines 
[PrcData.cbGrpprl](https://learn.microsoft.com/en-us/openspecs/office_file_formats/ms-doc/473fd992-c824-4655-8880-3186bd432f80)
 as a *signed* 16-bit size (MUST be <= 0x3FA2). #1387 read it with `getUShort`, 
so a malformed prefix of 0x8000+ was rejected only when it exceeded the 
remaining data stream; in a data stream of 64 KB or more it was accepted and 
junk was read as a grpprl. This reads it with `getShort` and rejects negative 
sizes. The 0x3FA2 cap is deliberately not enforced, to avoid rejecting 
real-world files that exceed it.
   
   Expanded `TestPAPX` coverage:
   - negative size prefix in a data stream large enough to hold it as unsigned
   - `Integer.MAX_VALUE` offset (overflowed the pre-#1387 `offset + 1 < length` 
check)
   - offsets at `length - 1`, `length`, `length + 1` (no room for the size 
prefix)
   - zero-size grpprl at the very end of the data stream (accepted)
   - grpprl ending exactly at the last byte (accepted)
   - sprmPHugePapx (0x6645) as well as sprmPHugePapx2
   - null data stream keeps the stub
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to