File tree Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " json"
3
- version = " 0.11.12 "
3
+ version = " 0.11.13 "
4
4
authors = [
" Maciej Hirsz <[email protected] >" ]
5
5
description = " JSON implementation in Rust"
6
6
repository = " https://github.com/maciejhirsz/json-rust"
Original file line number Diff line number Diff line change @@ -578,7 +578,7 @@ impl<'a> Parser<'a> {
578
578
num. checked_add ( ( ch - b'0' ) as u64 )
579
579
} ) {
580
580
Some ( result) => num = result,
581
- None => e += 1 ,
581
+ None => e = e . checked_add ( 1 ) . ok_or_else ( || Error :: ExceededDepthLimit ) ? ,
582
582
}
583
583
} ,
584
584
b'.' => {
Original file line number Diff line number Diff line change @@ -367,3 +367,14 @@ fn does_not_panic_on_single_zero() {
367
367
368
368
parse ( source) . unwrap ( ) ;
369
369
}
370
+
371
+ #[ test]
372
+ fn does_not_panic_on_huge_numbers ( ) {
373
+ let mut string = String :: from ( "8" ) ;
374
+
375
+ for _ in 1 ..32787 {
376
+ string. push ( '0' ) ;
377
+ }
378
+
379
+ let _ = json:: parse ( & string) ;
380
+ }
You can’t perform that action at this time.
0 commit comments