Skip to content

Commit

Permalink
Fix COSPredictorDecode
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximPlusov committed Dec 16, 2024
1 parent 8d57da4 commit 23f2274
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/main/java/org/verapdf/cos/filters/COSPredictorDecode.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,19 @@ public int read(byte[] buffer, int size) throws IOException {
linePredictor += 10;
}

int read;
if ((read = bufferPopArray(currentLine, lineLength)) != lineLength) {
int read = bufferPopArray(currentLine, lineLength);
while (read != lineLength) {
if (this.feedBuffer(this.getBufferCapacity()) == -1) {
this.streamEnded = true;
break;
}
byte[] extraBytes = new byte[lineLength - read];
int readAgain;
if ((readAgain = bufferPopArray(extraBytes, extraBytes.length)) != extraBytes.length) {
this.streamEnded = true;
break;
}
int readAgain = bufferPopArray(extraBytes, extraBytes.length);
System.arraycopy(extraBytes, 0, currentLine, read, readAgain);
read += readAgain;
}
if (streamEnded) {
break;
}

switch (linePredictor) {
Expand Down

0 comments on commit 23f2274

Please sign in to comment.