File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed 
src/ImageSharp/Formats/Tiff/Compression/Decompressors Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -125,13 +125,29 @@ public bool ReadNextCodeWord()
125125                    if  ( value  ==  Len7Code0000000 . Code ) 
126126                    { 
127127                        this . Code  =  Len7Code0000000 ; 
128-                         return  false ; 
128+ 
129+                         // We do not support Extensions1D codes, but some encoders (scanner from epson) write a premature EOL code, 
130+                         // which at this point cannot be distinguished from the marker, because we read the data bit by bit. 
131+                         // Read the next 5 bit, if its a EOL code return true, indicating its the end of the image. 
132+                         if  ( this . ReadValue ( 5 )  ==  1 ) 
133+                         { 
134+                             return  true ; 
135+                         } 
136+ 
137+                         throw  new  NotSupportedException ( "ccitt extensions 1D codes are not supported." ) ; 
129138                    } 
130139
131140                    if  ( value  ==  Len7Code0000001 . Code ) 
132141                    { 
133142                        this . Code  =  Len7Code0000001 ; 
134-                         return  false ; 
143+ 
144+                         // Same as above, we do not support Extensions2D codes, but it could be a EOL instead. 
145+                         if  ( this . ReadValue ( 5 )  ==  1 ) 
146+                         { 
147+                             return  true ; 
148+                         } 
149+ 
150+                         throw  new  NotSupportedException ( "ccitt extensions 2D codes are not supported." ) ; 
135151                    } 
136152
137153                    if  ( value  ==  Len7Code0000011 . Code ) 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments