diff options
author | Even Rouault <even.rouault@spatialys.com> | 2023-05-06 18:45:50 +0000 |
---|---|---|
committer | Even Rouault <even.rouault@spatialys.com> | 2023-05-06 18:45:50 +0000 |
commit | e53b14876f276d9bad75307055933754d94e80e1 (patch) | |
tree | 8cdd3bb2c7855e29870f785fb71d0a42acb41c3d | |
parent | 9bd48f0dbd64fb94dc2b5b05238fde0bfdd4ff3f (diff) | |
parent | d0c721cad7e5e90904b0112ba56be28c35fe4394 (diff) | |
download | libtiff-git-e53b14876f276d9bad75307055933754d94e80e1.tar.gz |
Merge branch 'tif_ojpeg_fix-554_FPE' into 'master'
tif_ojpeg.c fix 554 by checking for division by zero
Closes #554
See merge request libtiff/libtiff!486
-rw-r--r-- | libtiff/tif_ojpeg.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libtiff/tif_ojpeg.c b/libtiff/tif_ojpeg.c index 0c915de2..ea572091 100644 --- a/libtiff/tif_ojpeg.c +++ b/libtiff/tif_ojpeg.c @@ -1360,6 +1360,9 @@ static int OJPEGWriteHeaderInfo(TIFF *tif) { assert(sp->subsampling_convert_ycbcrbuf == 0); assert(sp->subsampling_convert_ycbcrimage == 0); + /* Check for division by zero. */ + if (sp->subsampling_hor == 0 || sp->subsampling_ver == 0) + return (0); sp->subsampling_convert_ylinelen = ((sp->strile_width + sp->subsampling_hor * 8 - 1) / (sp->subsampling_hor * 8) * sp->subsampling_hor * 8); |