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
This commit is contained in:
Ben Noordhuis 2024-10-29 22:52:56 +01:00 committed by GitHub
parent 56e5ffa2db
commit 42262a7c53
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6507,6 +6507,8 @@ static int find_line_num(JSContext *ctx, JSFunctionBytecode *b,
*col = 1;
p = b->pc2line_buf;
if (!p)
goto fail;
p_end = p + b->pc2line_len;
pc = 0;
line_num = b->line_num;