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

dcraw: increase linear table parsing to 65536 values #6448

Merged
merged 1 commit into from
Dec 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions rtengine/dcraw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6292,11 +6292,11 @@ void CLASS parse_mos (int offset)
void CLASS linear_table (unsigned len)
{
int i;
if (len > 0x1000) len = 0x1000;
if (len > 0x10000) len = 0x10000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you change this conditional, wouldn't there be a problem for the intermediate range? I.e. when len > 0x1000 and len < 0x10000?

Copy link
Contributor Author

@sgotti sgotti Mar 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All entries above the tag provided number of entries will all have the last entry value and maximum will also have it.

With this patch for 4096 entries all the entries from index 4096 to 65535 will have the value of curve[4095].

In the current code, instead, all entries above 4096 will instead have value of the index (initialized in dcraw::identify) since they aren't populated (or are they populated in another code path?).

So there's something different but I'm unsure if this will have bad effects.

read_shorts (curve, len);
for (i=len; i < 0x1000; i++)
for (i=len; i < 0x10000; i++)
curve[i] = curve[i-1];
maximum = curve[0xfff];
maximum = curve[0xffff];
}

void CLASS parse_kodak_ifd (int base)
Expand Down