From 7afe0a69bc26798ca04ad72eacb97feefed94b50 Mon Sep 17 00:00:00 2001 From: Frank Warmerdam Date: Sat, 11 Aug 2001 03:41:07 +0000 Subject: [PATCH] fixed problem copying overlapping buffers in TIFFReadRGBATile() --- ChangeLog | 6 ++++++ libtiff/tif_getimage.c | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 484d0fb3..a74685d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2001-08-10 Frank Warmerdam + * libtiff/tif_getimage.c: Use memmove() instead of TIFFmemcpy() + in TIFFReadRGBATile() to avoid issues in cases of overlapping + buffers. See Bug 69 in Bugzilla. + + http://bugzilla.remotesensing.org/show_bug.cgi?id=69 + * tools/tiff2rgba.c: fixed getopt() call so that -b works again. 2001-08-09 Frank Warmerdam diff --git a/libtiff/tif_getimage.c b/libtiff/tif_getimage.c index 9112f5e1..285ed053 100644 --- a/libtiff/tif_getimage.c +++ b/libtiff/tif_getimage.c @@ -1,4 +1,4 @@ -/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_getimage.c,v 1.10 2001-07-18 13:27:35 warmerda Exp $ */ +/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_getimage.c,v 1.11 2001-08-11 03:41:07 warmerda Exp $ */ /* * Copyright (c) 1991-1997 Sam Leffler @@ -2345,9 +2345,9 @@ TIFFReadRGBATile(TIFF* tif, uint32 col, uint32 row, uint32 * raster) for( i_row = 0; i_row < read_ysize; i_row++ ) { - _TIFFmemcpy( raster + (tile_ysize - i_row - 1) * tile_xsize, - raster + (read_ysize - i_row - 1) * read_xsize, - read_xsize * sizeof(uint32) ); + memmove( raster + (tile_ysize - i_row - 1) * tile_xsize, + raster + (read_ysize - i_row - 1) * read_xsize, + read_xsize * sizeof(uint32) ); _TIFFmemset( raster + (tile_ysize - i_row - 1) * tile_xsize+read_xsize, 0, sizeof(uint32) * (tile_xsize - read_xsize) ); } @@ -2357,6 +2357,6 @@ TIFFReadRGBATile(TIFF* tif, uint32 col, uint32 row, uint32 * raster) _TIFFmemset( raster + (tile_ysize - i_row - 1) * tile_xsize, 0, sizeof(uint32) * tile_xsize ); } - + return (ok); }