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).
(cherry picked from commit 059599fc78
)
This commit is contained in:
@ -1341,7 +1341,10 @@ save_image (const gchar *filename,
|
||||
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)
|
||||
|
Reference in New Issue
Block a user