File tree Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Original file line number Diff line number Diff line change 66
77* Raise MSRV to 1.59.0
88* Change to 2021 edition
9+ * Drop lifetime annotations of reader parameter in ` ArchiveIterator::from_read `
10+ and ` ArchiveIterator::from_read_with_encoding ` [ #90 ]
911
1012## [ 0.13.0] - 2022-08-03
1113
Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ impl<R: Read + Seek> ArchiveIterator<R> {
126126 /// ```
127127 pub fn from_read_with_encoding ( source : R , decode : DecodeCallback ) -> Result < ArchiveIterator < R > >
128128 where
129- R : Read + Seek + ' static ,
129+ R : Read + Seek ,
130130 {
131131 let utf8_guard = ffi:: UTF8LocaleGuard :: new ( ) ;
132132 let reader = source;
@@ -231,7 +231,7 @@ impl<R: Read + Seek> ArchiveIterator<R> {
231231 /// ```
232232 pub fn from_read ( source : R ) -> Result < ArchiveIterator < R > >
233233 where
234- R : Read + Seek + ' static ,
234+ R : Read + Seek ,
235235 {
236236 ArchiveIterator :: from_read_with_encoding ( source, crate :: decode_utf8)
237237 }
Original file line number Diff line number Diff line change 33// SPDX-License-Identifier: MIT OR Apache-2.0
44
55use compress_tools:: * ;
6- use std:: path:: Path ;
6+ use std:: {
7+ io:: { Cursor , Read } ,
8+ path:: Path ,
9+ } ;
710
811#[ test]
912fn get_compressed_file_content ( ) {
@@ -631,6 +634,28 @@ fn iterate_truncated_archive() {
631634 panic ! ( "Did not find expected error" ) ;
632635}
633636
637+ fn uncompress_bytes_helper ( bytes : & [ u8 ] ) {
638+ let wrapper = Cursor :: new ( bytes) ;
639+
640+ for content in ArchiveIterator :: from_read ( wrapper) . unwrap ( ) {
641+ if let ArchiveContents :: Err ( Error :: Unknown ) = content {
642+ return ;
643+ }
644+ }
645+
646+ panic ! ( "Did not find expected error" ) ;
647+ }
648+
649+ #[ test]
650+ fn uncompress_bytes ( ) {
651+ let mut source = std:: fs:: File :: open ( "tests/fixtures/truncated.log.gz" ) . unwrap ( ) ;
652+
653+ let mut buffer = Vec :: new ( ) ;
654+ source. read_to_end ( & mut buffer) . unwrap ( ) ;
655+
656+ uncompress_bytes_helper ( & buffer)
657+ }
658+
634659#[ test]
635660fn uncompress_archive_zip_slip_vulnerability ( ) {
636661 uncompress_archive (
You can’t perform that action at this time.
0 commit comments