jmestwa-coder opened a new pull request, #1105:
URL: https://github.com/apache/poi/pull/1105

   ## Summary
   
   Restore the `fillFields()` contract in `EscherBSERecord` by returning the 
number of bytes actually consumed from the input stream rather than a 
reconstructed serialized size.
   
   ## Problem
   
   `EscherBSERecord.fillFields()` returned the embedded blip's 
`getRecordSize()`, which can differ from the number of bytes actually read when 
malformed records contain inconsistent size information.
   
   This can cause parent containers to advance by an incorrect offset and 
mis-locate subsequent sibling records during parsing.
   
   ## Fix
   
   - Return the actual number of bytes consumed (`bytesRead`) when calculating 
the value returned by `fillFields()`.
   - Preserve the expected parser invariant that `fillFields()` reports 
consumed input bytes.
   
   ## Test
   
   - Add a regression test covering a malformed `EscherMetafileBlip` whose 
`cbSave` value exceeds the data declared by the record length.
   - Verify that `EscherBSERecord.fillFields()` reports the record's actual 
on-disk length rather than an inflated reconstructed size.
   - Demonstrate that the previous behavior would over-report consumed bytes 
and cause parser offset drift.


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