Commit f384a071 authored by Ell's avatar Ell

Issue #1783 - Xcf file crashing gimp-console-2.10 ...

... (Invalid read reported by valgrind)

In gimp_image_parasite_validate(), don't segfault when validating
a "gimp-comment" parasite of size 0 (i.e., whose data is a 0-byte
array, not an empty string), and just consider it invalid.
parent 6ebadea7
......@@ -3542,12 +3542,15 @@ gimp_image_parasite_validate (GimpImage *image,
{
const gchar *data = gimp_parasite_data (parasite);
gssize length = gimp_parasite_data_size (parasite);
gboolean valid;
gboolean valid = FALSE;
if (data[length - 1] == '\0')
valid = g_utf8_validate (data, -1, NULL);
else
valid = g_utf8_validate (data, length, NULL);
if (length > 0)
{
if (data[length - 1] == '\0')
valid = g_utf8_validate (data, -1, NULL);
else
valid = g_utf8_validate (data, length, NULL);
}
if (! valid)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment