Skip to content

Commit

Permalink
Fix UndefinedBehaviorSanitizer error
Browse files Browse the repository at this point in the history
UBSan is right to complain that `s->ptr_last == NULL` when tracing is
disabled.
  • Loading branch information
bnoordhuis committed Oct 24, 2024
1 parent 62f4713 commit 4fbce79
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -35019,7 +35019,8 @@ static JSValue JS_ReadFunctionTag(BCReaderState *s)
goto fail;
if (b->source_len) {
bc_read_trace(s, "source: %d bytes\n", b->source_len);
s->ptr_last += b->source_len; // omit source code hex dump
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);
if (!b->source)
Expand Down

0 comments on commit 4fbce79

Please sign in to comment.