Fix UndefinedBehaviorSanitizer error

UBSan is right to complain that `s->ptr_last == NULL` when tracing is
disabled.
This commit is contained in:
Ben Noordhuis 2024-10-24 09:09:40 +02:00
parent 62f4713780
commit 4fbce79521

View file

@ -35019,6 +35019,7 @@ static JSValue JS_ReadFunctionTag(BCReaderState *s)
goto fail;
if (b->source_len) {
bc_read_trace(s, "source: %d bytes\n", b->source_len);
if (s->ptr_last)
s->ptr_last += b->source_len; // omit source code hex dump
/* b->source is a UTF-8 encoded null terminated C string */
b->source = js_mallocz(ctx, b->source_len + 1);