Skip to content
This repository has been archived by the owner on Dec 1, 2017. It is now read-only.

Commit

Permalink
* libtiff/tif_jpeg.c: avoid integer division by zero in
Browse files Browse the repository at this point in the history
JPEGSetupEncode() when horizontal or vertical sampling is set to 0.
Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2653
  • Loading branch information
erouault committed Jan 11, 2017
1 parent 2c00d31 commit 47f2fb6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
@@ -1,3 +1,9 @@
2017-01-11 Even Rouault <even.rouault at spatialys.com>

* libtiff/tif_jpeg.c: avoid integer division by zero in
JPEGSetupEncode() when horizontal or vertical sampling is set to 0.
Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2653

2017-01-03 Even Rouault <even.rouault at spatialys.com>

* libtiff/tif_jpeg.c: increase libjpeg max memory usable to
Expand Down
7 changes: 7 additions & 0 deletions libtiff/tif_jpeg.c
Expand Up @@ -1626,6 +1626,13 @@ JPEGSetupEncode(TIFF* tif)
case PHOTOMETRIC_YCBCR:
sp->h_sampling = td->td_ycbcrsubsampling[0];
sp->v_sampling = td->td_ycbcrsubsampling[1];
if( sp->h_sampling == 0 || sp->v_sampling == 0 )
{
TIFFErrorExt(tif->tif_clientdata, module,
"Invalig horizontal/vertical sampling value");
return (0);
}

/*
* A ReferenceBlackWhite field *must* be present since the
* default value is inappropriate for YCbCr. Fill in the
Expand Down

0 comments on commit 47f2fb6

Please sign in to comment.