Fixes Oss-Fuzz issue: 21916 (#1180)

* Fix heap-buffer-overflow in json_reader
This commit is contained in:
kabeer27 2020-05-29 19:20:26 +05:30 committed by GitHub
parent c161f4ac69
commit 6aba23f4a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1270,7 +1270,7 @@ void OurReader::skipSpaces() {
void OurReader::skipBom(bool skipBom) {
// The default behavior is to skip BOM.
if (skipBom) {
if (strncmp(begin_, "\xEF\xBB\xBF", 3) == 0) {
if ((end_ - begin_) >= 3 && strncmp(begin_, "\xEF\xBB\xBF", 3) == 0) {
begin_ += 3;
current_ = begin_;
}