Nico Williams df95871dd7 Fix leak on too-large programs, OSS Fuzz issue 61349
A very large program can cause these leaks:

  ==758838== 7,820 (16 direct, 7,804 indirect) bytes in 2 blocks are definitely lost in loss record 17 of 28
  ==758838==    at 0x4848A23: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==758838==    by 0x125D30: jv_mem_calloc (jv_alloc.c:153)
  ==758838==    by 0x162ADE: compile (compile.c:1286)
  ==758838==    by 0x162D4B: compile (compile.c:1304)
  ==758838==    by 0x163697: block_compile (compile.c:1381)
  ==758838==    by 0x11B5CA: jq_compile_args (execute.c:1245)
  ==758838==    by 0x115E20: main (main.c:691)
  ==758838==
  ==758838== 1,674,694 (103,576 direct, 1,571,118 indirect) bytes in 1,177 blocks are definitely lost in loss record 28 of 28
  ==758838==    at 0x4843839: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==758838==    by 0x125CD0: jv_mem_alloc (jv_alloc.c:141)
  ==758838==    by 0x162B19: compile (compile.c:1289)
  ==758838==    by 0x163697: block_compile (compile.c:1381)
  ==758838==    by 0x11B5CA: jq_compile_args (execute.c:1245)
  ==758838==    by 0x115E20: main (main.c:691)

This commit fixes that.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=61349
2023-08-29 10:27:41 +02:00
2018-10-12 16:23:09 -04:00
2023-07-16 00:02:46 -05:00
2023-08-27 12:53:29 -05:00
2017-02-18 21:34:26 -05:00
2023-06-13 20:01:20 +09:00
2023-06-13 20:01:20 +09:00
2016-02-24 00:39:56 -08:00
2023-06-19 00:07:29 -05:00

jq

jq is a lightweight and flexible command-line JSON processor akin tosed,awk,grep, and friends for JSON data. It's written in portable C and has zero runtime dependencies, allowing you to easily slice, filter, map, and transform structured data.

Documentation

Installation

Prebuilt Binaries

Download the latest releases from the GitHub release page.

Docker Image

Pull the jq image to start quickly with Docker.

Building from source

Dependencies

  • libtool
  • make
  • automake
  • autoconf

Instructions

git submodule update --init # if building from git to get oniguruma
autoreconf -i               # if building from git
./configure --with-oniguruma=builtin
make -j8
make check
sudo make install

Build a statically linked version:

make LDFLAGS=-all-static

If you're not using the latest git version but instead building a released tarball (available on the release page), skip the autoreconf step, and flex or bison won't be needed.

Cross-Compilation

For details on cross-compliation, check out the GitHub Actions file and the cross-compliation wiki page.

Community & Support

License

jq is released under the MIT License.

S
Description
No description provided
Readme BSD-2-Clause, MIT
24 MiB
0 Stars 1 Watchers 0 Forks
Languages
C 78.7%
M4 6.4%
Shell 6.3%
Yacc 3.2%
jq 1.5%
Other 3.9%