File tree Expand file tree Collapse file tree 1 file changed +0
-21
lines changed
rust/fory-core/src/serializer Expand file tree Collapse file tree 1 file changed +0
-21
lines changed Original file line number Diff line number Diff line change @@ -46,27 +46,6 @@ impl Serializer for String {
4646 let bitor = context. reader . read_varuint36small ( ) ?;
4747 let len = bitor >> 2 ;
4848 let encoding = bitor & 0b11 ;
49- let len_usize = usize:: try_from ( len) . map_err ( |_| {
50- Error :: invalid_data ( format ! (
51- "string length {} overflows usize on this platform" ,
52- len
53- ) )
54- } ) ?;
55- let byte_len = match encoding {
56- 1 => len_usize. saturating_mul ( 2 ) ,
57- _ => len_usize,
58- } ;
59- let remaining = context
60- . reader
61- . bf
62- . len ( )
63- . saturating_sub ( context. reader . cursor ) ;
64- if byte_len > remaining {
65- return Err ( Error :: invalid_data ( format ! (
66- "string byte length {} exceeds buffer remaining {}" ,
67- byte_len, remaining
68- ) ) ) ;
69- }
7049 let s = match encoding {
7150 0 => context. reader . read_latin1_string ( len as usize ) ,
7251 1 => context. reader . read_utf16_string ( len as usize ) ,
You can’t perform that action at this time.
0 commit comments