We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bc116a4 commit 970e353Copy full SHA for 970e353
1 file changed
pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java
@@ -47,7 +47,9 @@ public class PDFStreamParser extends COSParser
47
*/
48
private static final Logger LOG = LogManager.getLogger(PDFStreamParser.class);
49
50
- private static final Pattern NUMBER_PATTERN = Pattern.compile("^(?>\\d*)\\.?(?>\\d*)$");
+ // Pattern to match numbers (integers or decimals). Safe from ReDoS: no overlapping quantifiers
51
+ // or character classes that cause backtracking. The optional decimal group is explicit and bounded.
52
+ private static final Pattern NUMBER_PATTERN = Pattern.compile("^\\d*(\\.\\d*)?$");
53
private static final int MAX_BIN_CHAR_TEST_LENGTH = 10;
54
private final byte[] binCharTestArr = new byte[MAX_BIN_CHAR_TEST_LENGTH];
55
private int inlineImageDepth = 0;
0 commit comments