[quickjs] Fix undefined flexible array member This is a continuation of fxrev.dev/694821, that fixed usage of quickjs in host tools, but evidently this is also used on target where the roll of 694821 failed. Bug: 103545 Change-Id: I4f7b5b1918089365109aa838314d762753403708
diff --git a/quickjs.c b/quickjs.c index 722fd58..c1d3cf4 100644 --- a/quickjs.c +++ b/quickjs.c
@@ -2769,6 +2769,8 @@ p->header.ref_count = 1; p->is_wide_char = str->is_wide_char; p->len = str->len; + void **dest = p->is_wide_char ? (void **)&p->u.str16 : (void **)&p->u.str8; + *dest = &p->str_storage; #ifdef DUMP_LEAKS list_add_tail(&p->link, &rt->string_list); #endif @@ -3559,6 +3561,8 @@ str = js_realloc2(s->ctx, s->str, sizeof(JSString) + (size << 1), &slack); if (!str) return string_buffer_set_error(s); + void **dest = s->is_wide_char ? (void **)&str->u.str16 : (void **)&str->u.str8; + *dest = &str->str_storage; size += slack >> 1; for(i = s->len; i-- > 0;) { str->u.str16[i] = str->u.str8[i];