mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 09:44:31 +03:00
Use more specific regex chars to prevent ReDoS
* CVE-2021-25292
This commit is contained in:
parent
cbdce6c5d0
commit
3bce145966
|
@ -580,8 +580,9 @@ class PdfParser:
|
||||||
whitespace_or_hex = br"[\000\011\012\014\015\0400-9a-fA-F]"
|
whitespace_or_hex = br"[\000\011\012\014\015\0400-9a-fA-F]"
|
||||||
whitespace_optional = whitespace + b"*"
|
whitespace_optional = whitespace + b"*"
|
||||||
whitespace_mandatory = whitespace + b"+"
|
whitespace_mandatory = whitespace + b"+"
|
||||||
|
whitespace_optional_no_nl = br"[\000\011\014\015\040]*" # no "\012" aka "\n"
|
||||||
newline_only = br"[\r\n]+"
|
newline_only = br"[\r\n]+"
|
||||||
newline = whitespace_optional + newline_only + whitespace_optional
|
newline = whitespace_optional_no_nl + newline_only + whitespace_optional_no_nl
|
||||||
re_trailer_end = re.compile(
|
re_trailer_end = re.compile(
|
||||||
whitespace_mandatory
|
whitespace_mandatory
|
||||||
+ br"trailer"
|
+ br"trailer"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user