Control: tags -1 patch I've attached a patch corresponding to my patch I've posted upstream, but without the testcases and with 2 lines of context removed, so that it can be applied on either the current Debian package (file 1:5.41-3) or upstream code.
-- Vincent Lefèvre <[email protected]> - Web: <https://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
Description: Files consisting of JSON + garbage are misdetected as JSON data Bug-Debian: https://bugs.debian.org/1008247 Bug: https://bugs.astron.com/view.php?id=332 Author: Vincent Lefevre <[email protected]> Last-Update: 2022-03-25 The fix consists in testing, at the end of the recursion (lvl == 0), whether the end of the file has been reached (after trailing whitespace has been skipped). diff --git a/src/is_json.c b/src/is_json.c index 93bb0456..604cf9e6 100644 --- a/src/is_json.c +++ b/src/is_json.c @@ -394,5 +394,5 @@ out: if (lvl == 0) - return rv && (st[JSON_ARRAYN] || st[JSON_OBJECT]); + return rv && uc == ue && (st[JSON_ARRAYN] || st[JSON_OBJECT]); return rv; }

