Skip to content
Open
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
8 changes: 6 additions & 2 deletions rtengine/dcraw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3867,7 +3867,7 @@ void CLASS foveon_huff (ushort *huff)
void CLASS foveon_dp_load_raw()
{
unsigned c, roff[4], row, col, diff;
ushort huff[512], vpred[2][2], hpred[2];
ushort huff[1024], vpred[2][2], hpred[2];

fseek (ifp, 8, SEEK_CUR);
foveon_huff (huff);
Expand All @@ -3891,12 +3891,16 @@ void CLASS foveon_dp_load_raw()
void CLASS foveon_load_camf()
{
unsigned type, wide, high, i, j, row, col, diff;
ushort huff[258], vpred[2][2] = {{512,512},{512,512}}, hpred[2];
ushort huff[1024], vpred[2][2] = {{512,512},{512,512}}, hpred[2];

fseek (ifp, meta_offset, SEEK_SET);
type = get4(); get4(); get4();
wide = get4();
high = get4();
#ifdef LIBRAW_LIBRARY_BUILD
Copy link
Collaborator

Choose a reason for hiding this comment

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

The ifdef doesn't make sense in our context. Probably the lines should be always enabled, but then throwing an exception might be problematic. In any case art should not be executed in security-critical situations anyway, there are probably many other potentially-exploitable vulnerabilities in the rest of the code...

if(wide>32767 || high > 32767 || wide*high > 20000000)
throw LIBRAW_EXCEPTION_IO_CORRUPT;
#endif
if (type == 2) {
fread (meta_data, 1, meta_length, ifp);
for (i=0; i < meta_length; i++) {
Expand Down