2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-21 10:29:08 +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:
m-holger 2024-09-24 01:32:32 +01:00
parent 477fbd9839
commit 0aa6b67eea
5 changed files with 3 additions and 3 deletions

View File

@ -2,7 +2,6 @@
<project version="4">
<component name="CMakeSharedSettings">
<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="Windows" ENABLED="true" CONFIG_NAME="RelWithDebInfo" TOOLCHAIN_NAME="Visual Studio" GENERATION_OPTIONS="-DBUILD_SHARED_LIBS=OFF" />
</configurations>

View File

@ -145,6 +145,7 @@ set(CORPUS_OTHER
99999a.fuzz
99999b.fuzz
99999c.fuzz
99999d.fuzz
)
set(CORPUS_DIR ${CMAKE_CURRENT_BINARY_DIR}/qpdf_corpus)

BIN
fuzz/qpdf_extra/99999d.fuzz Normal file

Binary file not shown.

View File

@ -11,7 +11,7 @@ my $td = new TestDriver('fuzz');
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 = (
['ascii85' => 1],

View File

@ -47,7 +47,7 @@ QPDFWordTokenFinder::check()
// Find a word token matching the given string, preceded by a delimiter, and followed by a
// delimiter or EOF.
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();
if (!(t == QPDFTokenizer::Token(QPDFTokenizer::tt_word, str))) {
QTC::TC("qpdf", "QPDFTokenizer finder found wrong word");