Issue 128542

Summary: Bugs in the scripting module's XInputStreamImpl
Product: App Dev Reporter: damjan
Component: apiAssignee: AOO issues mailing list <issues>
Status: RESOLVED FIXED QA Contact:
Severity: Normal    
Priority: P5 (lowest) CC: mseidel
Version: 3.3.0 or older (OOo)   
Target Milestone: 4.1.14   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---

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