Fix buffer overrun in SimpleParser::handleBackslash
commitb3679121bb3c7017ff04b4c08402ffff5cf59b13
authorMark Williams <mwilliams@fb.com>
Thu, 20 Feb 2020 23:41:33 +0000 (20 15:41 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 20 Feb 2020 23:54:42 +0000 (20 15:54 -0800)
tree2313d37484ce1c62346e1e02669c122fb5f2b0b8
parentbd586671a3c22eb2f07e55f11b3ce64e1f7961e7
Fix buffer overrun in SimpleParser::handleBackslash

Summary:
It read 4 chars, then checked for validity, but any of them could have
been the end of the string, so check after each one instead.

Reviewed By: oulgen

Differential Revision: D19611163

fbshipit-source-id: 3da0a39555cb85a93f4fd98048368f17cf37e2e4
hphp/runtime/ext/json/JSON_parser.cpp
hphp/test/slow/ext_json/decode_crash.php
hphp/test/slow/ext_json/decode_crash.php.expect