Package: file Version: 1:5.41-4 Severity: normal Tags: upstream fixed-upstream patch Forwarded: https://bugs.astron.com/view.php?id=327
"file" fails to detect JSON files with many levels: $ echo '{"a":{"b":{"c":{"d":[{"e":[{"f":{"g":[{"h":0}]}}]}]}}}}' | file - /dev/stdin: ASCII text This has been fixed upstream by increasing the number of allowed levels: https://github.com/file/file/commit/6511e6f45a534551b0293e82a434e3cd6504066c I've attached the corresponding patch without the changes in the debug messages. -- System Information: Debian Release: bookworm/sid APT prefers unstable-debug APT policy: (500, 'unstable-debug'), (500, 'stable-updates'), (500, 'stable-security'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 5.17.0-2-amd64 (SMP w/8 CPU threads; PREEMPT) Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE Locale: LANG=POSIX, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages file depends on: ii libc6 2.33-7 ii libmagic1 1:5.41-4 file recommends no packages. file suggests no packages. -- no debconf information -- Vincent Lefèvre <vinc...@vinc17.net> - 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)
Index: b/src/is_json.c =================================================================== --- a/src/is_json.c +++ b/src/is_json.c @@ -338,7 +338,7 @@ json_parse(const unsigned char **ucp, co goto out; // Avoid recursion - if (lvl > 20) + if (lvl > 500) return 0; #if JSON_COUNT /* bail quickly if not counting */