Merge branch 'issue-211' into 'master'
check for tile width overflow Closes #211 See merge request libtiff/libtiff!160
This commit is contained in:
commit
d167fbb6af
@ -394,7 +394,7 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
|
|||||||
if (tif->tif_mode != O_RDONLY)
|
if (tif->tif_mode != O_RDONLY)
|
||||||
goto badvalue32;
|
goto badvalue32;
|
||||||
TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
|
TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
|
||||||
"Nonstandard tile width %d, convert file", v32);
|
"Nonstandard tile width %u, convert file", v32);
|
||||||
}
|
}
|
||||||
td->td_tilewidth = v32;
|
td->td_tilewidth = v32;
|
||||||
tif->tif_flags |= TIFF_ISTILED;
|
tif->tif_flags |= TIFF_ISTILED;
|
||||||
@ -405,7 +405,7 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
|
|||||||
if (tif->tif_mode != O_RDONLY)
|
if (tif->tif_mode != O_RDONLY)
|
||||||
goto badvalue32;
|
goto badvalue32;
|
||||||
TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
|
TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
|
||||||
"Nonstandard tile length %d, convert file", v32);
|
"Nonstandard tile length %u, convert file", v32);
|
||||||
}
|
}
|
||||||
td->td_tilelength = v32;
|
td->td_tilelength = v32;
|
||||||
tif->tif_flags |= TIFF_ISTILED;
|
tif->tif_flags |= TIFF_ISTILED;
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "tiffiop.h"
|
#include "tiffiop.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
static int gtTileContig(TIFFRGBAImage*, uint32*, uint32, uint32);
|
static int gtTileContig(TIFFRGBAImage*, uint32*, uint32, uint32);
|
||||||
static int gtTileSeparate(TIFFRGBAImage*, uint32*, uint32, uint32);
|
static int gtTileSeparate(TIFFRGBAImage*, uint32*, uint32, uint32);
|
||||||
@ -645,12 +646,20 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
|
|||||||
|
|
||||||
flip = setorientation(img);
|
flip = setorientation(img);
|
||||||
if (flip & FLIP_VERTICALLY) {
|
if (flip & FLIP_VERTICALLY) {
|
||||||
y = h - 1;
|
if ((tw + w) > INT_MAX) {
|
||||||
toskew = -(int32)(tw + w);
|
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", "unsupported tile size (too wide)");
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
y = h - 1;
|
||||||
|
toskew = -(int32)(tw + w);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
y = 0;
|
if (tw > (INT_MAX + w)) {
|
||||||
toskew = -(int32)(tw - w);
|
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", "unsupported tile size (too wide)");
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
y = 0;
|
||||||
|
toskew = -(int32)(tw - w);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user