Skip to content

Commit 4fbce79

Browse files
committed
Fix UndefinedBehaviorSanitizer error
UBSan is right to complain that `s->ptr_last == NULL` when tracing is disabled.
1 parent 62f4713 commit 4fbce79

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

quickjs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35019,7 +35019,8 @@ static JSValue JS_ReadFunctionTag(BCReaderState *s)
3501935019
goto fail;
3502035020
if (b->source_len) {
3502135021
bc_read_trace(s, "source: %d bytes\n", b->source_len);
35022-
s->ptr_last += b->source_len; // omit source code hex dump
35022+
if (s->ptr_last)
35023+
s->ptr_last += b->source_len; // omit source code hex dump
3502335024
/* b->source is a UTF-8 encoded null terminated C string */
3502435025
b->source = js_mallocz(ctx, b->source_len + 1);
3502535026
if (!b->source)

0 commit comments

Comments
 (0)