Skip to content

Commit

Permalink
Fix UBSAN error
Browse files Browse the repository at this point in the history
  • Loading branch information
andrjohns committed Jan 24, 2024
1 parent 2302940 commit 547df2d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -33345,7 +33345,13 @@ static JSValue js_create_function(JSContext *ctx, JSFunctionDef *fd)
}
} else {
b->vardefs = (void *)((uint8_t*)b + vardefs_offset);
#ifdef STRICT_R_HEADERS
if (fd->args)
#endif
memcpy(b->vardefs, fd->args, fd->arg_count * sizeof(fd->args[0]));
#ifdef STRICT_R_HEADERS
if (fd->vars)
#endif
memcpy(b->vardefs + fd->arg_count, fd->vars, fd->var_count * sizeof(fd->vars[0]));
}
b->var_count = fd->var_count;
Expand Down

0 comments on commit 547df2d

Please sign in to comment.