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 11[package ]
22name = " json"
3- version = " 0.11.12 "
3+ version = " 0.11.13 "
44authors = [" Maciej Hirsz <maciej.hirsz@gmail.com>" ]
55description = " JSON implementation in Rust"
66repository = " https://github.com/maciejhirsz/json-rust"
Original file line number Diff line number Diff line change @@ -578,7 +578,7 @@ impl<'a> Parser<'a> {
578578 num. checked_add ( ( ch - b'0' ) as u64 )
579579 } ) {
580580 Some ( result) => num = result,
581- None => e += 1 ,
581+ None => e = e . checked_add ( 1 ) . ok_or_else ( || Error :: ExceededDepthLimit ) ? ,
582582 }
583583 } ,
584584 b'.' => {
Original file line number Diff line number Diff line change @@ -367,3 +367,14 @@ fn does_not_panic_on_single_zero() {
367367
368368 parse ( source) . unwrap ( ) ;
369369}
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