fixed buffer overrun when previewing an image with alpha that was causing

2000-11-21  Austin Donnelly  <austin@gimp.org>

	* plug-ins/common/exchange.c: fixed buffer overrun when previewing
	    an image with alpha that was causing segfaults on Linux.
	    Fixes Bug#32860.
This commit is contained in:
Austin Donnelly 2000-11-21 18:16:06 +00:00 committed by Austin Donnelly
parent 54f243d76c
commit d7af7c0f3e
2 changed files with 15 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2000-11-21 Austin Donnelly <austin@gimp.org>
* plug-ins/common/exchange.c: fixed buffer overrun when previewing
an image with alpha that was causing segfaults on Linux.
Fixes Bug#32860.
2000-11-20 Sven Neumann <sven@gimp.org>
* app/convert.c (build_palette_button): changed the logic that sets

View File

@ -670,9 +670,15 @@ real_exchange (gint x1,
dest_row[idx + 1] = (guchar) new_green;
dest_row[idx + 2] = (guchar) new_blue;
/* copy rest (most likely alpha-channel) */
for (rest = 3; rest < bpp; rest++)
dest_row[idx + rest] = src_row[x * bpp + rest];
/* copy rest (ie the alpha-channel). But, only if we're not
* previewing, otherwise we don't have room for the alpha
* and overrun the buffer, causing a segfault on the
* g_free() at the bottom of this function. Maybe we should
* convert the alpha and blend in the chequerboard pattern,
* but I'll leave that as an excercise for the reader... */
if (!do_preview)
for (rest = 3; rest < bpp; rest++)
dest_row[idx + rest] = src_row[x * bpp + rest];
}
/* store the dest */
if (do_preview)