Issue 128542 - Bugs in the scripting module's XInputStreamImpl
Summary: Bugs in the scripting module's XInputStreamImpl
Status: RESOLVED FIXED
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All All
: P5 (lowest) Normal
Target Milestone: 4.1.14
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-22 11:18 UTC by damjan
Modified: 2022-10-31 09:39 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description damjan 2022-10-22 11:18:04 UTC
In main/scripting/java/com/sun/star/script/framework/io/XInputStreamImpl.java
we need to:
- Check the loop termination in readBytes() properly: currently it increments
  totalBytesRead while also decrementing nBytesToRead, so when compared to
  each other, the loop terminates when the buffer is half full. Only check
  for nBytesToRead instead.
- Trim the sequence to the size actually read.
- Deal with the possibility of available() returning 0 in readSomeBytes().
Comment 1 damjan 2022-10-22 11:18:17 UTC
Fixed by commit 7e29bacc90c4b1b9788c3b71dfacd17daecde7a7, resolving fixed.
Comment 2 Matthias Seidel 2022-10-23 16:50:04 UTC
Cherry-picked for AOO42X with:
https://github.com/apache/openoffice/commit/4313305f54da9ea9933f9bd443a549ffa6b66876
Comment 3 Matthias Seidel 2022-10-31 09:39:26 UTC
Cherry-picked for AOO41X with:
https://github.com/apache/openoffice/commit/4271e4a8d1fe4fd139f365686585a11457a0b972