File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -36257,6 +36257,10 @@ static JSString *JS_ReadString(BCReaderState *s)
3625736257 return NULL;
3625836258 is_wide_char = len & 1;
3625936259 len >>= 1;
36260+ if (len > JS_STRING_LEN_MAX) {
36261+ JS_ThrowInternalError(s->ctx, "string too long");
36262+ return NULL;
36263+ }
3626036264 p = js_alloc_string(s->ctx, len, is_wide_char);
3626136265 if (!p) {
3626236266 s->error_state = -1;
@@ -36368,8 +36372,7 @@ static JSValue JS_ReadBigInt(BCReaderState *s)
3636836372 bc_read_trace(s, "}\n");
3636936373 return __JS_NewShortBigInt(s->ctx, 0);
3637036374 }
36371- p = js_bigint_new(s->ctx,
36372- (len + (JS_LIMB_BITS / 8) - 1) / (JS_LIMB_BITS / 8));
36375+ p = js_bigint_new(s->ctx, (len - 1) / (JS_LIMB_BITS / 8) + 1);
3637336376 if (!p)
3637436377 goto fail;
3637536378 for(i = 0; i < len / (JS_LIMB_BITS / 8); i++) {
Original file line number Diff line number Diff line change @@ -285,16 +285,17 @@ function bjson_test_bytecode()
285285function bjson_test_fuzz ( )
286286{
287287 var corpus = [
288- "EBAAAAAABGA=" ,
289- "EObm5oIt" ,
290- "EAARABMGBgYGBgYGBgYGBv////8QABEALxH/vy8R/78=" ,
288+ "FBAAAAAABGA=" ,
289+ "FObm5oIt" ,
290+ "FAARABMGBgYGBgYGBgYGBv////8QABEALxH/vy8R/78=" ,
291+ "FAAIfwAK/////3//////////////////////////////3/8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAAAAAAAAAAD5+fn5+fn5+fn5+fkAAAAAAAYAqw==" ,
291292 ] ;
292293 for ( var input of corpus ) {
293294 var buf = base64decode ( input ) ;
294295 try {
295296 bjson . read ( buf , 0 , buf . byteLength ) ;
296297 } catch ( e ) {
297- // okay, ignore
298+ if ( / i n v a l i d v e r s i o n / . test ( e . message ) ) throw e ; // corpus needs update
298299 }
299300 }
300301}
You can’t perform that action at this time.
0 commit comments