Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tiff: ccitt compression, fix for issue #2451 #2483

Merged
merged 3 commits into from
Jun 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,29 @@ public bool ReadNextCodeWord()
if (value == Len7Code0000000.Code)
{
this.Code = Len7Code0000000;
return false;

// We do not support Extensions1D codes, but some encoders (scanner from epson) write a premature EOL code,
// which at this point cannot be distinguished from the marker, because we read the data bit by bit.
// Read the next 5 bit, if its a EOL code return true, indicating its the end of the image.
if (this.ReadValue(5) == 1)
{
return true;
}

throw new NotSupportedException("ccitt extensions 1D codes are not supported.");
}

if (value == Len7Code0000001.Code)
{
this.Code = Len7Code0000001;
return false;

// Same as above, we do not support Extensions2D codes, but it could be a EOL instead.
if (this.ReadValue(5) == 1)
{
return true;
}

throw new NotSupportedException("ccitt extensions 2D codes are not supported.");
}

if (value == Len7Code0000011.Code)
Expand Down