Skip to content

Commit

Permalink
Fix crash on numeric comparison (ref jqlang#2804) (jqlang#2818)
Browse files Browse the repository at this point in the history
  • Loading branch information
itchyny authored Aug 3, 2023
1 parent 53a62cf commit 949d38e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/jv.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ static decContext* tsd_dec_ctx_get(pthread_key_t *key) {
if (key == &dec_ctx_key)
{
decContextDefault(ctx, DEC_INIT_BASE);
ctx->digits = DEC_MAX_DIGITS;
ctx->digits = DEC_MAX_DIGITS - 1;
ctx->traps = 0; /*no errors*/
}
else if (key == &dec_ctx_dbl_key)
Expand Down
4 changes: 4 additions & 0 deletions tests/jq.test
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,10 @@ null
null
1e+17

5E500000000>5E-5000000000
null
true

25 % 7
null
4
Expand Down

0 comments on commit 949d38e

Please sign in to comment.