@@ -32018,7 +32018,7 @@ typedef enum BCTagEnum {
3201832018 BC_TAG_OBJECT_REFERENCE,
3201932019} BCTagEnum;
3202032020
32021- #define BC_VERSION 7
32021+ #define BC_VERSION 8
3202232022
3202332023typedef struct BCWriterState {
3202432024 JSContext *ctx;
@@ -32440,6 +32440,8 @@ static int JS_WriteFunctionTag(BCWriterState *s, JSValue obj)
3244032440 bc_put_leb128(s, b->col_num);
3244132441 bc_put_leb128(s, b->pc2line_len);
3244232442 dbuf_put(&s->dbuf, b->pc2line_buf, b->pc2line_len);
32443+ bc_put_leb128(s, b->source_len);
32444+ dbuf_put(&s->dbuf, b->source, b->source_len);
3244332445
3244432446 /* compatibility */
3244532447 dbuf_putc(&s->dbuf, 255);
@@ -33017,7 +33019,7 @@ static int bc_get_leb128_u16(BCReaderState *s, uint16_t *pval)
3301733019 return 0;
3301833020}
3301933021
33020- static int bc_get_buf(BCReaderState *s, uint8_t *buf, uint32_t buf_len)
33022+ static int bc_get_buf(BCReaderState *s, void *buf, uint32_t buf_len)
3302133023{
3302233024 if (buf_len != 0) {
3302333025 if (unlikely(!buf || s->buf_end - s->ptr < buf_len))
@@ -33413,6 +33415,15 @@ static JSValue JS_ReadFunctionTag(BCReaderState *s)
3341333415 if (bc_get_buf(s, b->pc2line_buf, b->pc2line_len))
3341433416 goto fail;
3341533417 }
33418+ if (bc_get_leb128_int(s, &b->source_len))
33419+ goto fail;
33420+ if (b->source_len) {
33421+ b->source = js_mallocz(ctx, b->source_len);
33422+ if (!b->source)
33423+ goto fail;
33424+ if (bc_get_buf(s, b->source, b->source_len))
33425+ goto fail;
33426+ }
3341633427 if (s->buf_end - s->ptr > 3 && s->ptr[0] == 255 &&
3341733428 s->ptr[1] == 73 && s->ptr[2] == 67) {
3341833429 s->ptr += 3;
0 commit comments