Commit Graph
1943 Commits
Author SHA1 Message Date
itchyny 6aeafff056 Fix gmtime and localtime on negative timestamps with fractional seconds (#3634)
The whole seconds were truncated toward zero while the fractional part
was measured from the floor, so any negative non-integral timestamp was
rendered one second late; gmtime was not monotonic across the epoch.
2026-09-18 18:45:36 +09:00
itchyny 57f5976edf website: fold older versions on the download page (#3635)
Only the latest release stays visible in the binary, checksum and
signature, and source tarball lists; older versions move into
collapsible `<details>` sections. Condense the repetitive per-version
checksum and signature sentences into a single list.
2026-09-18 17:07:54 +09:00
Hugohong258andHugohong258 1b4109b0d0 docs: clarify that prebuilt downloads are standalone executables (#3632)
State explicitly in the README and download page that the
platform-specific prebuilt files are standalone executables, not
archives. Include the rename and executable-permission step for macOS
and Linux in the README.

Addresses #2956. Source archives are not described as executables.

Validation: the official `docs/build_website.py` completed and the
generated download page contains the new guidance. Used a Python venv
with the site's required rendering packages; restored the Windows
checkout's manual symlink in a temporary build copy only. jq itself was
not built or tested for this documentation-only change.

Co-authored-by: Hugohong258 <282228220+Hugohong258@users.noreply.github.com>
2026-09-15 11:13:25 +02:00
dependabot[bot] 9d241e2772 build(deps): bump markdown from 3.10.2 to 3.10.3 in /docs (#3622) 2026-09-01 15:30:46 +09:00
dependabot[bot] 8bce8b6543 build(deps): bump lxml from 6.1.1 to 6.1.2 in /docs (#3621) 2026-09-01 15:24:58 +09:00
Anna Rift 41b8edfe54 Fix a handful of typos (#3605) 2026-08-24 00:06:16 +09:00
Thomas Klausner 17b411837d Fix strftime-related functions on NetBSD. (#3579) 2026-08-24 00:03:21 +09:00
august fbee8f48ba Reject raw NUL bytes in the parser instead of silently truncating tokens (#3606) 2026-08-24 00:01:54 +09:00
A4-Tacks 8cf81cb80c docs: in example use [3,4] instead of [0,1] (#3599) 2026-08-23 23:28:10 +09:00
Anna Rift 4bb50d772b Fix typo 'you may wish [to] use' (#3604)
Fix all instances of the phrase "you may wish use `fabs`" -> "you may
wish _to_ use `fabs`" (emphasis mine) in the manual.
2026-08-12 21:02:39 +02:00
dependabot[bot] 603db3f577 build(deps): bump actions/setup-python from 6 to 7 in the official-actions group (#3595) 2026-07-26 10:10:34 +09:00
ded-furby 2d410d6d86 docs: clarify join behavior on objects (#3555) 2026-07-19 21:27:45 +09:00
WinkleMad f1f39b42e3 Advance past the whole codepoint after a zero-width regex match (#3586) 2026-07-19 21:13:51 +09:00
pavel kuliaka dbcaa9d491 shtest: skip locale test if date lacks locale support (#3583) 2026-07-18 17:03:18 +09:00
Thomas Klausner 579e6f76cf Cast char to unsigned char before passing to isspace (#3574) 2026-07-02 14:45:10 +09:00
itchyny 42d4035d4f Add a download link for Windows arm64 2026-06-22 19:31:20 +09:00
itchyny 3c81b62958 Update jq documentation for jq 1.8.2 release 2026-06-20 23:17:39 +09:00
github-actions[bot]andgithub-actions[bot] f0dabad36a Update signatures of 1.8.2 (#3566)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-06-20 23:12:40 +09:00
dependabot[bot] 34f7186b86 build(deps): bump actions/checkout from 6 to 7 in the official-actions group (#3565) jq-1.8.2 2026-06-20 20:58:06 +09:00
itchyny 88e83408f2 Update NEWS.md and AUTHORS for 1.8.2 (#3529) 2026-06-17 22:33:44 +09:00
itchyny a5a29cccc5 Upload attestation bundle as a release artifact (#3563)
The bundle generated by actions/attest is currently only retrievable
via the GitHub attestations API, which requires authentication.
Uploading it as jq-attestation.json lets downstream consumers
(distro packagers, unauthenticated CI) verify provenance offline.
2026-06-16 14:35:02 +09:00
itchynyandDirk Müller 46d1da3094 Tighten string length bounds and propagate invalid jv in implode
The bound added in CVE-2026-32316 (e47e56d22) still allowed
`sizeof(jvp_string) + (currlen + len) * 2 + 1` to wrap `size_t` on
32-bit platforms. Tighten the threshold so the final allocation
fits in 32-bit `size_t`.

Also break out of `jv_string_implode` and `f_string_implode` once
`jv_string_append_codepoint` returns an invalid `jv`; otherwise the
next iteration triggers the assertion in `jvp_string_ptr` (or
invokes undefined behavior under `-DNDEBUG`).

Fixes CVE-2026-54679.

Co-authored-by: Dirk Müller <dirk@dmllr.de>
2026-06-16 14:33:04 +09:00
itchyny e987df0d46 Fix heap-buffer-overflow in raw file loading
When `jv_string_append_buf` overflows the string length limit,
it returns an invalid `jv`; `jv_load_file` then re-entered it
on the invalid value and overran the heap. Break out of the loop
once the value is invalid.

Fixes CVE-2026-49839.
2026-06-08 22:15:06 +09:00
dependabot[bot] 985abe534f build(deps): bump lxml from 6.1.0 to 6.1.1 in /docs (#3553) 2026-06-02 08:36:56 +09:00
theyoucheng df924eae91 Fix undefined pointer arithmetic in UTF-8 helpers
Fixes GHSA-ggc9-rpv2-xgpm and GHSA-gvwx-xj9r-3frq.
2026-05-23 10:11:11 +09:00
itchyny a829f678f3 Fix one-byte over-read in BASE64_DECODE_TABLE (#3547)
The table was declared with 255 entries but indexed by an unsigned
char, so the decoder would read one byte past the array for input
bytes equal to 0xFF. Through jq's normal input paths the over-read
is unreachable because invalid UTF-8 bytes are normalized to U+FFFD
before reaching @base64d, but the table is still wrong at the C
level and reachable by libjq callers that construct strings via
the C API without UTF-8 validation.
2026-05-23 09:36:15 +09:00
Yu-Fu Fu 7122866869 Guard deep structural equality and comparison recursion (#3539)
jv_equal and jv_cmp overflows the C stack on deeply nested
input. Cap recursion at 10000 with -1 / INT_MIN sentinels;
operators that compose user expressions surface this as
"Equality check too deep" / "Comparison too deep".

Fixes CVE-2026-47770.
2026-05-22 20:07:16 +09:00
itchyny f58787c418 Detect circular module imports to prevent stack overflow
jq used to recurse without bound on mutual or self-referential
`import` declarations, exhausting the stack. Track each library's
load state with a `loading` flag set before its dependencies are
processed; a recursive reference to an in-progress library now
reports "circular import of X".

Fixes CVE-2026-44777.
2026-05-11 20:41:38 +09:00
itchyny 9d223f153c Reject embedded NUL bytes in module import paths
jq accepts embedded NUL bytes at the language level but resolves
module import paths through NUL-terminated C strings, so the path
validated by policy or audit code could differ from the on-disk
path jq actually opens. Pass jv through gen_import so the AST
preserves the original bytes, and reject embedded NULs in
validate_relpath.

Fixes CVE-2026-43895.
2026-05-09 17:08:43 +09:00
itchyny 9761ceb7d6 Reject numeric literals longer than DEC_MAX_DIGITS (999999999)
A signed-int overflow in decNumber's D2U macro lets huge literals
write attacker-controlled bytes past a stack buffer. Cap the length
before calling decNumberFromString, and pre-slice long strings in
jv_dump_string_trunc so the resulting error message doesn't itself
allocate a multi-GiB buffer.

Fixes CVE-2026-43894.
2026-05-06 19:45:24 +09:00
itchyny 532ccea608 Limit recursive object merge depth to prevent stack overflow
This fixes CVE-2026-43896.
2026-05-05 22:44:02 +09:00
itchyny 33d7bce321 Avoid stack overflow when freeing deeply nested values 2026-05-05 20:31:29 +09:00
itchyny 7316e5ce4b Fix CI to add artifact-metadata permission for actions/attest (#3530) 2026-05-05 14:06:45 +09:00
itchyny 63751f8a9f Fix signed-int overflow in tokenadd to prevent buffer overflow 2026-04-26 22:59:17 +09:00
Rohan Santhosh Kumar 5f2a14dd1b docs: fix "happened" spelling in tutorial changelog entries (#3525) jq-1.8.2rc1 2026-04-24 22:33:53 +09:00
itchyny 5a015deae3 Fix NUL truncation in program files loaded with -f
This fixes CVE-2026-41256.
2026-04-24 22:15:08 +09:00
itchyny 01b3cded76 Fix signed-int overflow in stack_reallocate
This fixes CVE-2026-41257.
2026-04-24 22:09:44 +09:00
itchyny d1a12569d9 Limit the containment check depth
This fixes CVE-2026-40612.
2026-04-24 22:02:24 +09:00
dependabot[bot] 870207323d build(deps): bump lxml from 6.0.2 to 6.1.0 in /docs (#3526) 2026-04-22 15:36:33 +09:00
dependabot[bot] 1eaa31acea build(deps): bump actions/upload-pages-artifact from 4 to 5 in the official-actions group (#3523) 2026-04-22 15:36:15 +09:00
itchyny fb59f14910 Limit path depth to prevent stack overflow
Deeply nested path arrays can cause unbounded recursion in
`jv_setpath`, `jv_getpath`, and `jv_delpaths`, leading to
stack overflow. Add a depth limit of 10000 to match the
existing `tojson` depth limit. This fixes CVE-2026-33947.
2026-04-13 11:23:40 +09:00
itchynyandMattias Wadman 2f09060afa Fix out-of-bounds read in jv_parse_sized()
This fixes CVE-2026-39979.

Co-authored-by: Mattias Wadman <mattias.wadman@gmail.com>
2026-04-13 11:04:52 +09:00
itchynyandAsaf Meizner 0c7d133c3c Randomize hash seed to mitigate hash collision DoS attacks
The hash function used a fixed seed, allowing attackers to craft colliding keys
and cause O(n^2) object parsing performance. Initialize the seed from a random
source at process startup to prevent the attack. This fixes CVE-2026-40164.

Co-authored-by: Asaf Meizner <asafmeizner@gmail.com>
2026-04-13 08:53:26 +09:00
itchyny 6374ae0bcd Fix NUL truncation in the JSON parser
This fixes CVE-2026-33948.
2026-04-13 08:46:11 +09:00
tlsbollei fdf8ef0f08 Add runtime type checks to f_string_indexes
This fixes CVE-2026-39956.
2026-04-08 21:43:46 +02:00
itchyny e47e56d226 Fix heap buffer overflow in jvp_string_append and jvp_string_copy_replace_bad
In `jvp_string_append`, the allocation size `(currlen + len) * 2` could
overflow `uint32_t` when `currlen + len` exceeds `INT_MAX`, causing a small
allocation followed by a large `memcpy`.

In `jvp_string_copy_replace_bad`, the output buffer size calculation
`length * 3 + 1` could overflow `uint32_t`, again resulting in a small
allocation followed by a large write.

Add overflow checks to both functions to return an error for strings
that would exceed `INT_MAX` in length. Fixes CVE-2026-32316.
2026-04-13 08:27:16 +09:00
Vladimír Marek 9f778b4cb5 Add Solaris support (#3515)
I love jq :) So while updating the version we ship in Solaris I have
tried to modify stuff to make everything work out of the box. Just

```
autoreconf -fiv
./configure
gmake
gmake check
```

I also went ahead and created Solaris test action should you be
interested in having it too. The changes are not extensive and I have
tried to comment them nicely in each commit. Hopefully that's enough.

Thanks for jq!
2026-04-08 16:02:41 +02:00
Peter KjellerstedtandPeter Kjellerstedt 27f417f481 Support building with --disable-maintainer-mode and source != build dir (#3518)
If --disable-maintainer-mode is enabled, then the rules for generating
parser.[ch] and lexer.[ch] did nothing. This worked fine if the source
and build directories are the same as the pre-generated parser.c and
lexer.c files would suffice. However, if the build directory is not the
same as the source directory, then the rest of the Make rules expect
parser.[ch] and lexer.[ch] to have been created in the build directory
if their source files (parser.y and lexer.l) are newer than the target
files, which can happen in case the source is fetched using Git.

Avoid the problem by copying the files to the build directory if needed.

Co-authored-by: Peter Kjellerstedt <pkj@axis.com>
2026-04-08 12:58:49 +09:00
itchyny 69785bf77f Use // instead of //= in from_entries definition (#3516) 2026-04-02 22:04:51 +09:00
dependabot[bot] 847b6afd2c build(deps): bump actions/deploy-pages from 4 to 5 in the official-actions group (#3513) 2026-04-02 14:15:32 +09:00