[gimp] plug-ins: fix #6871 indexed tga file cannot be saved
- From: Jacob Boerema <jboerema src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins: fix #6871 indexed tga file cannot be saved
- Date: Tue, 18 Jan 2022 20:01:23 +0000 (UTC)
commit 059599fc78058dd2a964d0ff05e830638cc89202
Author: Jacob Boerema <jgboerema gmail com>
Date: Tue Jan 18 14:57:35 2022 -0500
plug-ins: fix #6871 indexed tga file cannot be saved
Exporting an image to TGA fails with a crash when it's an indexed image
with alpha channel. We were not taking into account that even though
the output is 1 byte per pixel, the input should allocate memory for
2 bytes per pixel (1 color index and 1 alpha channel).
plug-ins/common/file-tga.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/plug-ins/common/file-tga.c b/plug-ins/common/file-tga.c
index 8a74ecc51e..7c2e7e1a7b 100644
--- a/plug-ins/common/file-tga.c
+++ b/plug-ins/common/file-tga.c
@@ -1353,7 +1353,10 @@ save_image (GFile *file,
fputc (0, fp);
}
- pixels = g_new (guchar, width * out_bpp);
+ if (dtype == GIMP_INDEXEDA_IMAGE)
+ pixels = g_new (guchar, width * 2);
+ else
+ pixels = g_new (guchar, width * out_bpp);
data = g_new (guchar, width * out_bpp);
for (row = 0; row < height; ++row)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]