* tools/tiff2pdf.c: fix wrong usage of memcpy() that can trigger

unspecified behaviour.
Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2638
This commit is contained in:
Even Rouault 2016-12-20 17:13:26 +00:00
parent 7d919c7849
commit 7fb75582f4
2 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2016-12-20 Even Rouault <even.rouault at spatialys.com>
* tools/tiff2pdf.c: fix wrong usage of memcpy() that can trigger
unspecified behaviour.
Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2638
2016-12-18 Even Rouault <even.rouault at spatialys.com> 2016-12-18 Even Rouault <even.rouault at spatialys.com>
* libtiff/tif_getimage.c: fix potential memory leaks in error code * libtiff/tif_getimage.c: fix potential memory leaks in error code

View File

@ -1,4 +1,4 @@
/* $Id: tiff2pdf.c,v 1.98 2016-12-18 10:37:59 erouault Exp $ /* $Id: tiff2pdf.c,v 1.99 2016-12-20 17:13:26 erouault Exp $
* *
* tiff2pdf - converts a TIFF image to a PDF document * tiff2pdf - converts a TIFF image to a PDF document
* *
@ -3593,7 +3593,8 @@ void t2p_tile_collapse_left(
edgescanwidth = (scanwidth * edgetilewidth + (tilewidth - 1))/ tilewidth; edgescanwidth = (scanwidth * edgetilewidth + (tilewidth - 1))/ tilewidth;
for(i=0;i<tilelength;i++){ for(i=0;i<tilelength;i++){
_TIFFmemcpy( /* We use memmove() since there can be overlaps in src and dst buffers for the first items */
memmove(
&(((char*)buffer)[edgescanwidth*i]), &(((char*)buffer)[edgescanwidth*i]),
&(((char*)buffer)[scanwidth*i]), &(((char*)buffer)[scanwidth*i]),
edgescanwidth); edgescanwidth);