Commit 0198ff7e48c77b36b320afdca9f61848c68f32df
Committed by
GitHub
Merge pull request #1291 from m-holger/fuzz
In QPDFWordTokenFinder::check limit the token length
Showing
5 changed files
with
3 additions
and
3 deletions
.idea/cmake.xml
| @@ -2,7 +2,6 @@ | @@ -2,7 +2,6 @@ | ||
| 2 | <project version="4"> | 2 | <project version="4"> |
| 3 | <component name="CMakeSharedSettings"> | 3 | <component name="CMakeSharedSettings"> |
| 4 | <configurations> | 4 | <configurations> |
| 5 | - <configuration PROFILE_NAME="Debug" ENABLED="true" CONFIG_NAME="Debug" /> | ||
| 6 | <configuration PROFILE_NAME="Maintainer" ENABLED="true" CONFIG_NAME="RelWithDebInfo" GENERATION_OPTIONS="-DMAINTAINER_MODE=ON -DBUILD_STATIC_LIBS=OFF" /> | 5 | <configuration PROFILE_NAME="Maintainer" ENABLED="true" CONFIG_NAME="RelWithDebInfo" GENERATION_OPTIONS="-DMAINTAINER_MODE=ON -DBUILD_STATIC_LIBS=OFF" /> |
| 7 | <configuration PROFILE_NAME="Windows" ENABLED="true" CONFIG_NAME="RelWithDebInfo" TOOLCHAIN_NAME="Visual Studio" GENERATION_OPTIONS="-DBUILD_SHARED_LIBS=OFF" /> | 6 | <configuration PROFILE_NAME="Windows" ENABLED="true" CONFIG_NAME="RelWithDebInfo" TOOLCHAIN_NAME="Visual Studio" GENERATION_OPTIONS="-DBUILD_SHARED_LIBS=OFF" /> |
| 8 | </configurations> | 7 | </configurations> |
fuzz/CMakeLists.txt
| @@ -145,6 +145,7 @@ set(CORPUS_OTHER | @@ -145,6 +145,7 @@ set(CORPUS_OTHER | ||
| 145 | 99999a.fuzz | 145 | 99999a.fuzz |
| 146 | 99999b.fuzz | 146 | 99999b.fuzz |
| 147 | 99999c.fuzz | 147 | 99999c.fuzz |
| 148 | + 99999d.fuzz | ||
| 148 | ) | 149 | ) |
| 149 | 150 | ||
| 150 | set(CORPUS_DIR ${CMAKE_CURRENT_BINARY_DIR}/qpdf_corpus) | 151 | set(CORPUS_DIR ${CMAKE_CURRENT_BINARY_DIR}/qpdf_corpus) |
fuzz/qpdf_extra/99999d.fuzz
0 → 100644
No preview for this file type
fuzz/qtest/fuzz.test
| @@ -11,7 +11,7 @@ my $td = new TestDriver('fuzz'); | @@ -11,7 +11,7 @@ my $td = new TestDriver('fuzz'); | ||
| 11 | 11 | ||
| 12 | my $qpdf_corpus = $ENV{'QPDF_FUZZ_CORPUS'} || die "must set QPDF_FUZZ_CORPUS"; | 12 | my $qpdf_corpus = $ENV{'QPDF_FUZZ_CORPUS'} || die "must set QPDF_FUZZ_CORPUS"; |
| 13 | 13 | ||
| 14 | -my $n_qpdf_files = 82; # increment when adding new files | 14 | +my $n_qpdf_files = 83; # increment when adding new files |
| 15 | 15 | ||
| 16 | my @fuzzers = ( | 16 | my @fuzzers = ( |
| 17 | ['ascii85' => 1], | 17 | ['ascii85' => 1], |
libqpdf/QPDFTokenizer.cc
| @@ -47,7 +47,7 @@ QPDFWordTokenFinder::check() | @@ -47,7 +47,7 @@ QPDFWordTokenFinder::check() | ||
| 47 | // Find a word token matching the given string, preceded by a delimiter, and followed by a | 47 | // Find a word token matching the given string, preceded by a delimiter, and followed by a |
| 48 | // delimiter or EOF. | 48 | // delimiter or EOF. |
| 49 | QPDFTokenizer tokenizer; | 49 | QPDFTokenizer tokenizer; |
| 50 | - QPDFTokenizer::Token t = tokenizer.readToken(is, "finder", true); | 50 | + QPDFTokenizer::Token t = tokenizer.readToken(is, "finder", true, str.size() + 2); |
| 51 | qpdf_offset_t pos = is.tell(); | 51 | qpdf_offset_t pos = is.tell(); |
| 52 | if (!(t == QPDFTokenizer::Token(QPDFTokenizer::tt_word, str))) { | 52 | if (!(t == QPDFTokenizer::Token(QPDFTokenizer::tt_word, str))) { |
| 53 | QTC::TC("qpdf", "QPDFTokenizer finder found wrong word"); | 53 | QTC::TC("qpdf", "QPDFTokenizer finder found wrong word"); |