Skip to content

Commit

Permalink
GH-98 Parsing empty signed number (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
gtache committed Jul 7, 2020
1 parent a30c112 commit c4cf81a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions core/core-awt/src/main/java/org/icepdf/core/util/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

import org.icepdf.core.exceptions.PDFException;
import org.icepdf.core.io.*;
import org.icepdf.core.pobjects.*;
import org.icepdf.core.pobjects.Dictionary;
import org.icepdf.core.pobjects.*;
import org.icepdf.core.pobjects.annotations.Annotation;
import org.icepdf.core.pobjects.fonts.CMap;
import org.icepdf.core.pobjects.fonts.Font;
Expand Down Expand Up @@ -1113,11 +1113,11 @@ public Number getNumber(StringBuilder value) {
boolean isDecimal = false;
byte[] streamBytes = value.toString().getBytes();
int startTokenPos = 0;
boolean singed = streamBytes[startTokenPos] == '-';
boolean signed = streamBytes[startTokenPos] == '-';
boolean positive = streamBytes[startTokenPos] == '+';
startTokenPos = singed || positive ? startTokenPos + 1 : startTokenPos;
startTokenPos = signed || positive ? startTokenPos + 1 : startTokenPos;
// check for double sign, thanks oracle forms!
if (singed && streamBytes[startTokenPos] == '-') {
if (signed && startTokenPos < streamBytes.length && streamBytes[startTokenPos] == '-') {
startTokenPos++;
}
int current;
Expand All @@ -1136,7 +1136,7 @@ public Number getNumber(StringBuilder value) {
break;
}
}
if (singed) {
if (signed) {
if (isDecimal) {
return -(digit + decimal);
} else {
Expand Down

0 comments on commit c4cf81a

Please sign in to comment.