Skip to content

Commit

Permalink
Fixed possible foveon buffer overrun (Secunia SA750000)
Browse files Browse the repository at this point in the history
  • Loading branch information
alextutubalin committed Mar 4, 2017
1 parent ffea825 commit 194f592
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions dcraw_foveon.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,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 @@ -346,12 +346,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
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

0 comments on commit 194f592

Please sign in to comment.