Skip to content
Myr

Increase the maximum printing depth from 256 to 10000 (fixes #3413) (#3414)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Ish Nagy · committed by GitHub · parent 589a694 · Browse files · 3 files+21 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+21 added−2 removed

  • tests:+19 added−0 removed
  • other:+2 added−2 removed

3 files+21 added−2 removed

modified:.github/workflows/ci.yml+1 added-1 removed
235 unmodified lines
236 --with-oniguruma=builtin \237 --disable-shared \238 --enable-static \239 --enable-all-static \240 CFLAGS="-O2 -pthread -fstack-protector-all"240 CFLAGS="-O2 -pthread -fstack-protector-all -Wl,--stack,8388608"241 make -j$(nproc)242 file ./jq.exe243 cp ./jq.exe jq-${{ env.SUFFIX }}.exe244 - name: Test
180 unmodified lines
modified:src/jv_print.c+1 added-1 removed
15 unmodified lines
16#include "jv_alloc.h"17#include "jv_private.h"1819#ifndef MAX_PRINT_DEPTH20#define MAX_PRINT_DEPTH (256)20#define MAX_PRINT_DEPTH (10000)21#endif2223#define ESC "\033"24#define COL(c) (ESC "[" c "m")
401 unmodified lines
modified:tests/jq.test+19 added
2513 unmodified lines
2514strflocaltime("" | ., @uri)251502516""2517""25182519# regression tests for #34132520# upper range bounds should be in sync with the constants defined at2521# src/jv_parse.c:#define MAX_PARSING_DEPTH (N)2522# src/jv_print.c:#define MAX_PRINT_DEPTH (N)2523# (N-1)2524reduce range(9999) as $_ ([];[.]) | tojson | fromjson | flatten2525null2526[]25272528# (N)2529reduce range(10000) as $_ ([];[.]) | tojson | try (fromjson) catch . | (contains("<skipped: too deep>") | not) and contains("Exceeds depth limit for parsing")2530null2531true25322533# (N+1)2534reduce range(10001) as $_ ([];[.]) | tojson | contains("<skipped: too deep>")2535null2536true