Skip to content
Myr

Fix off-by-one bug in #1108 fix

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

authored by Nicolas Williams · committed by Nicolas Williams · parent 65cbaac · Browse files · 2 files+3 added−3 removed
This commit

State

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

Diff stats

2 files+3 added−3 removed

  • tests:+2 added−2 removed
  • other:+1 added−1 removed

2 files+3 added−3 removed

modified:src/jv.c+1 added-1 removed
295 unmodified lines
296 jv_free(a);297 return jv_array();298 }299300 if (a.offset + start > 1 << (sizeof(a.offset) * CHAR_BIT)) {300 if (a.offset + start >= 1 << (sizeof(a.offset) * CHAR_BIT)) {301 jv r = jv_array_sized(end - start);302 for (int i = start; i < end; i++)303 r = jv_array_append(r, jv_array_get(jv_copy(a), i));304 jv_free(a);
1048 unmodified lines
modified:tests/jq.test+2 added-2 removed
387 unmodified lines
388# This is written this way because [range(<large number>)] is389# significantly slower under valgrind than .[<large number>] = value.390#391# We range down rather than up so that we have just one realloc.392reduce range(70010;69999;-1) as $i ([]; .[$i] = $i)|.[69999:70003]392reduce range(65540;65536;-1) as $i ([]; .[$i] = $i)|.[65536:]393null394[null,70000,70001,70002]394[null,65537,65538,65539,65540]395396#397# Variables398#
987 unmodified lines