tif_fax3.h: extra buffer overflow checks. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=25934
This commit is contained in:
parent
c8f0a16f4a
commit
9febb7599a
@ -382,6 +382,11 @@ done1d: \
|
||||
*/
|
||||
#define CHECK_b1 do { \
|
||||
if (pa != thisrun) while (b1 <= a0 && b1 < lastx) { \
|
||||
if( pb + 1 >= sp->refruns + sp->nruns) { \
|
||||
TIFFErrorExt(tif->tif_clientdata, module, "Buffer overflow at line %u of %s %u", \
|
||||
sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip); \
|
||||
return (-1); \
|
||||
} \
|
||||
b1 += pb[0] + pb[1]; \
|
||||
pb += 2; \
|
||||
} \
|
||||
@ -401,6 +406,11 @@ done1d: \
|
||||
switch (TabEnt->State) { \
|
||||
case S_Pass: \
|
||||
CHECK_b1; \
|
||||
if( pb + 1 >= sp->refruns + sp->nruns) { \
|
||||
TIFFErrorExt(tif->tif_clientdata, module, "Buffer overflow at line %u of %s %u", \
|
||||
sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip); \
|
||||
return (-1); \
|
||||
} \
|
||||
b1 += *pb++; \
|
||||
RunLength += b1 - a0; \
|
||||
a0 = b1; \
|
||||
@ -479,11 +489,21 @@ done1d: \
|
||||
case S_V0: \
|
||||
CHECK_b1; \
|
||||
SETVALUE(b1 - a0); \
|
||||
if( pb >= sp->refruns + sp->nruns) { \
|
||||
TIFFErrorExt(tif->tif_clientdata, module, "Buffer overflow at line %u of %s %u", \
|
||||
sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip); \
|
||||
return (-1); \
|
||||
} \
|
||||
b1 += *pb++; \
|
||||
break; \
|
||||
case S_VR: \
|
||||
CHECK_b1; \
|
||||
SETVALUE(b1 - a0 + TabEnt->Param); \
|
||||
if( pb >= sp->refruns + sp->nruns) { \
|
||||
TIFFErrorExt(tif->tif_clientdata, module, "Buffer overflow at line %u of %s %u", \
|
||||
sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip); \
|
||||
return (-1); \
|
||||
} \
|
||||
b1 += *pb++; \
|
||||
break; \
|
||||
case S_VL: \
|
||||
|
Loading…
Reference in New Issue
Block a user