Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure to free default
@text
format on error
It seems that bison doesn't call destructors for mid-rule action components on error, since it does not know their type. A mid-rule action was used to allocate the "text" string used as format by string literals without a format, which would leak on error. This patch replaces it with a new NoFormat component of type <literal>. Now bison will call jv_free() on that string after a syntax error. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60836 $ ./jq '"' jq: error: syntax error, unexpected end of file, expecting QQSTRING_TEXT or QQSTRING_INTERP_START or QQSTRING_END (Unix shell quoting issues?) at <top-level>, line 1: " jq: 1 compile error ================================================================= ==1495450==ERROR: LeakSanitizer: detected memory leaks Direct leak of 21 byte(s) in 1 object(s) allocated from: #0 0x7fc21aee1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69 #1 0x557ccb6ff608 in jv_mem_alloc src/jv_alloc.c:141 SUMMARY: AddressSanitizer: 21 byte(s) leaked in 1 allocation(s).
- Loading branch information