File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -148,7 +148,12 @@ impl<ReaderT: super::RandomAccessFileReader> ForestCar<ReaderT> {
148148 "not recognizable as a `{FOREST_CAR_FILE_EXTENSION}` file"
149149 ) )
150150 } ) ?;
151- let index_start_pos = footer. index - ZSTD_SKIP_FRAME_LEN ;
151+ let index_start_pos = footer. index . checked_sub ( ZSTD_SKIP_FRAME_LEN ) . ok_or_else ( ||
152+ invalid_data ( format ! (
153+ "unexpected error: footer.index({}) < ZSTD_SKIP_FRAME_LEN({ZSTD_SKIP_FRAME_LEN})" ,
154+ footer. index
155+ ) ) ,
156+ ) ?;
152157
153158 let cursor = Cursor :: new_pos ( & reader, 0 ) ;
154159 let mut header_zstd_frame = decode_zstd_single_frame ( cursor) ?. into ( ) ;
Original file line number Diff line number Diff line change @@ -476,7 +476,7 @@ impl Writer {
476476 }
477477 pub async fn write_zstd_skip_frames_into ( self , writer : impl AsyncWrite ) -> io:: Result < ( ) > {
478478 // write every 128MiB slots to a skip frame
479- const CHUNK_FRAME_DATA_MAX_BYTES : usize = 128 * 1024 ;
479+ const CHUNK_FRAME_DATA_MAX_BYTES : usize = 128 * 1024 * 1024 ;
480480 let written_len = self . written_len ( ) ;
481481 self . write_zstd_skip_frames_into_inner (
482482 writer,
You can’t perform that action at this time.
0 commit comments