Skip to content

Commit 3228be4

Browse files
kabeer27dota17
authored andcommitted
Fixes Oss-Fuzz issue: 21916 (#1180)
* Fix heap-buffer-overflow in json_reader
1 parent 1d38f0d commit 3228be4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: src/lib_json/json_reader.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1287,7 +1287,7 @@ void OurReader::skipSpaces() {
12871287
void OurReader::skipBom(bool skipBom) {
12881288
// The default behavior is to skip BOM.
12891289
if (skipBom) {
1290-
if (strncmp(begin_, "\xEF\xBB\xBF", 3) == 0) {
1290+
if ((end_ - begin_) >= 3 && strncmp(begin_, "\xEF\xBB\xBF", 3) == 0) {
12911291
begin_ += 3;
12921292
current_ = begin_;
12931293
}

0 commit comments

Comments
 (0)