Skip to content

Commit 42262a7

Browse files
authoredOct 29, 2024
Don't segfault on missing line number data (#641)
Can be reproduced on the CLI but not from a script: # should throw "unsupported object class" TypeError $ qjs --std -e 'bjson.write(function(){})' /path/to/quickjs.c:6510:15: runtime error: applying zero offset to null pointer
1 parent 56e5ffa commit 42262a7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed
 

‎quickjs.c

+2
Original file line numberDiff line numberDiff line change
@@ -6507,6 +6507,8 @@ static int find_line_num(JSContext *ctx, JSFunctionBytecode *b,
65076507

65086508
*col = 1;
65096509
p = b->pc2line_buf;
6510+
if (!p)
6511+
goto fail;
65106512
p_end = p + b->pc2line_len;
65116513
pc = 0;
65126514
line_num = b->line_num;

0 commit comments

Comments
 (0)