Skip to content
Myr

Merge pull request from GHSA-686w-5m7m-54vc

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

decNumberToString calls for a buffer that can hold a string of digits+14 characters, not a buffer of size digits+14. We need to allocate an extra byte for the NUL byte. -10E-1000010001, for example, will be stringified as -1.0E-1000010000 and decNumberToString will currently write an extra NUL byte after the allocated buffer in the heap. Originally reported by @SEU-SSL on GitHub. Ref: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64574 Fixes GHSA-686w-5m7m-54vc

authored by Emanuele Torre · committed by GitHub · parent c9a5156 · Browse files · 3 files+7 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+7 added−2 removed

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

3 files+7 added−2 removed

modified:src/jv.c+1 added-1 removed
633 unmodified lines
634 return NULL;635 }636637 if (plit->literal_data == NULL) {638 int len = jvp_dec_number_ptr(n)->digits + 14;638 int len = jvp_dec_number_ptr(n)->digits + 15 /* 14 + NUL */;639 plit->literal_data = jv_mem_alloc(len);640641 // Preserve the actual precision as we have parsed it642 // don't do decNumberTrim(pdec);
1336 unmodified lines
modified:tests/shtest+5 added
607 unmodified lines
608 echo "passing the inline script before -- didn't work"609 exit 1610fi611612# CVE-2023-50246: No heap overflow for '-10E-1000000001'613$VALGRIND $Q $JQ . <<\NUM614-10E-1000000001615NUM616617exit 0
modified:NEWS.md+1 added-1 removed
1# 1.7.123## Security45- CVE-2023-50246: ....5- CVE-2023-50246: Fix heap buffer overflow in jvp\_literal\_number\_literal6- CVE-2023-50268: fix stack-buffer-overflow if comparing nan with payload78## CLI changes9
382 unmodified lines