Skip to content

Commit

Permalink
Unicode string indexing should remain an error
Browse files Browse the repository at this point in the history
  • Loading branch information
nicowilliams committed Jul 25, 2023
1 parent 10770ab commit 574dfbf
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -681,11 +681,8 @@ jv jq_next(jq_state *jq) {
if (jv_get_kind(t) == JV_KIND_STRING && jv_get_kind(k) == JV_KIND_NUMBER) {
switch (jv_get_string_kind(t)) {
case JV_STRING_KIND_UTF8:
uint32_t c = jv_string_index(t, jv_number_value(k));
if (c == (uint32_t)-1)
v = jv_null();
else
v = jv_string_append_codepoint(jv_string(""), c);
v = jv_invalid_with_msg(jv_string("Cannot index string with number"));
jv_free(t);
jv_free(k);
break;
case JV_STRING_KIND_BINARY:
Expand Down

0 comments on commit 574dfbf

Please sign in to comment.