mirror of https://github.com/GNOME/gimp.git
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).
This commit is contained in:
parent
1c8aad4f68
commit
059599fc78
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue