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()
125
125
if ( value == Len7Code0000000 . Code )
126
126
{
127
127
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." ) ;
129
138
}
130
139
131
140
if ( value == Len7Code0000001 . Code )
132
141
{
133
142
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." ) ;
135
151
}
136
152
137
153
if ( value == Len7Code0000011 . Code )
You can’t perform that action at this time.
0 commit comments