File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed
tests/fuzz_images/oor_panic Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -145,12 +145,15 @@ impl Image {
145145 . map ( SampleFormat :: from_u16_exhaustive)
146146 . collect ( ) ;
147147
148+ let Some ( format) = sample_format. first ( ) . copied ( ) else {
149+ // Reject empty sample formats
150+ return Err ( TiffFormatError :: InvalidTagValueType ( Tag :: SampleFormat ) . into ( ) ) ;
151+ } ;
148152 // TODO: for now, only homogenous formats across samples are supported.
149- if !sample_format. windows ( 2 ) . all ( |s| s[ 0 ] == s [ 1 ] ) {
153+ if !sample_format. iter ( ) . all ( |& s| s == format ) {
150154 return Err ( TiffUnsupportedError :: UnsupportedSampleFormat ( sample_format) . into ( ) ) ;
151155 }
152-
153- sample_format[ 0 ]
156+ format
154157 }
155158 None => SampleFormat :: Uint ,
156159 } ;
Original file line number Diff line number Diff line change @@ -38,7 +38,9 @@ pub type Predictor = crate::tags::Predictor;
3838pub type DeflateLevel = compression:: DeflateLevel ;
3939
4040#[ derive( Clone , Copy , PartialEq ) ]
41+ #[ derive( Default ) ]
4142pub enum Compression {
43+ #[ default]
4244 Uncompressed ,
4345 #[ cfg( feature = "lzw" ) ]
4446 Lzw ,
@@ -47,11 +49,6 @@ pub enum Compression {
4749 Packbits ,
4850}
4951
50- impl Default for Compression {
51- fn default ( ) -> Self {
52- Self :: Uncompressed
53- }
54- }
5552
5653impl Compression {
5754 fn tag ( & self ) -> CompressionMethod {
You can’t perform that action at this time.
0 commit comments