2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 19:08:59 +00:00

Fix JSON parser error found by fuzz

This commit is contained in:
Jay Berkenbilt 2024-02-04 17:27:43 -05:00
parent f0fb19df9d
commit 7ae095fa09
3 changed files with 4 additions and 2 deletions

View File

@ -0,0 +1 @@
"\,,,,,p,,-\,,,,

View File

@ -16,7 +16,7 @@ my @fuzzers = (
['dct' => 1], ['dct' => 1],
['flate' => 1], ['flate' => 1],
['hex' => 1], ['hex' => 1],
['json' => 37], ['json' => 38],
['lzw' => 2], ['lzw' => 2],
['pngpredictor' => 1], ['pngpredictor' => 1],
['runlength' => 6], ['runlength' => 6],

View File

@ -1246,7 +1246,8 @@ JSONParser::handleToken()
break; break;
default: default:
throw std::logic_error("JSONParser::handleToken : non-terminal lexer state encountered"); throw std::runtime_error(
"JSON: offset " + std::to_string(offset) + ": premature end of input");
break; break;
} }