mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 02:49:00 +00:00
In QPDFWordTokenFinder::check limit the token length
Tokens longer than the target cannot be a match and therefore there is no need to read to the end of token.
This commit is contained in:
parent
477fbd9839
commit
0aa6b67eea
@ -2,7 +2,6 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="CMakeSharedSettings">
|
<component name="CMakeSharedSettings">
|
||||||
<configurations>
|
<configurations>
|
||||||
<configuration PROFILE_NAME="Debug" ENABLED="true" CONFIG_NAME="Debug" />
|
|
||||||
<configuration PROFILE_NAME="Maintainer" ENABLED="true" CONFIG_NAME="RelWithDebInfo" GENERATION_OPTIONS="-DMAINTAINER_MODE=ON -DBUILD_STATIC_LIBS=OFF" />
|
<configuration PROFILE_NAME="Maintainer" ENABLED="true" CONFIG_NAME="RelWithDebInfo" GENERATION_OPTIONS="-DMAINTAINER_MODE=ON -DBUILD_STATIC_LIBS=OFF" />
|
||||||
<configuration PROFILE_NAME="Windows" ENABLED="true" CONFIG_NAME="RelWithDebInfo" TOOLCHAIN_NAME="Visual Studio" GENERATION_OPTIONS="-DBUILD_SHARED_LIBS=OFF" />
|
<configuration PROFILE_NAME="Windows" ENABLED="true" CONFIG_NAME="RelWithDebInfo" TOOLCHAIN_NAME="Visual Studio" GENERATION_OPTIONS="-DBUILD_SHARED_LIBS=OFF" />
|
||||||
</configurations>
|
</configurations>
|
||||||
|
@ -145,6 +145,7 @@ set(CORPUS_OTHER
|
|||||||
99999a.fuzz
|
99999a.fuzz
|
||||||
99999b.fuzz
|
99999b.fuzz
|
||||||
99999c.fuzz
|
99999c.fuzz
|
||||||
|
99999d.fuzz
|
||||||
)
|
)
|
||||||
|
|
||||||
set(CORPUS_DIR ${CMAKE_CURRENT_BINARY_DIR}/qpdf_corpus)
|
set(CORPUS_DIR ${CMAKE_CURRENT_BINARY_DIR}/qpdf_corpus)
|
||||||
|
BIN
fuzz/qpdf_extra/99999d.fuzz
Normal file
BIN
fuzz/qpdf_extra/99999d.fuzz
Normal file
Binary file not shown.
@ -11,7 +11,7 @@ my $td = new TestDriver('fuzz');
|
|||||||
|
|
||||||
my $qpdf_corpus = $ENV{'QPDF_FUZZ_CORPUS'} || die "must set QPDF_FUZZ_CORPUS";
|
my $qpdf_corpus = $ENV{'QPDF_FUZZ_CORPUS'} || die "must set QPDF_FUZZ_CORPUS";
|
||||||
|
|
||||||
my $n_qpdf_files = 82; # increment when adding new files
|
my $n_qpdf_files = 83; # increment when adding new files
|
||||||
|
|
||||||
my @fuzzers = (
|
my @fuzzers = (
|
||||||
['ascii85' => 1],
|
['ascii85' => 1],
|
||||||
|
@ -47,7 +47,7 @@ QPDFWordTokenFinder::check()
|
|||||||
// Find a word token matching the given string, preceded by a delimiter, and followed by a
|
// Find a word token matching the given string, preceded by a delimiter, and followed by a
|
||||||
// delimiter or EOF.
|
// delimiter or EOF.
|
||||||
QPDFTokenizer tokenizer;
|
QPDFTokenizer tokenizer;
|
||||||
QPDFTokenizer::Token t = tokenizer.readToken(is, "finder", true);
|
QPDFTokenizer::Token t = tokenizer.readToken(is, "finder", true, str.size() + 2);
|
||||||
qpdf_offset_t pos = is.tell();
|
qpdf_offset_t pos = is.tell();
|
||||||
if (!(t == QPDFTokenizer::Token(QPDFTokenizer::tt_word, str))) {
|
if (!(t == QPDFTokenizer::Token(QPDFTokenizer::tt_word, str))) {
|
||||||
QTC::TC("qpdf", "QPDFTokenizer finder found wrong word");
|
QTC::TC("qpdf", "QPDFTokenizer finder found wrong word");
|
||||||
|
Loading…
Reference in New Issue
Block a user