From 83bd1c86faa293b1c6456147395be18ade24f748 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Sun, 17 Nov 2013 01:22:52 +0100 Subject: [PATCH] app: gimp_brush_load_brush(): add special error for possible old files The obsolete .gbp format had a 3-byte pattern following a 1-byte brush, when embedded in a brush pipe, the current code tries to load that pattern as a brush, and encounters the '3' in the header. Detect that and suggest to re-save the file because the plug-in still loads the legacy format. --- app/core/gimpbrush-load.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/core/gimpbrush-load.c b/app/core/gimpbrush-load.c index b752b0e6ba..68cbac29ac 100644 --- a/app/core/gimpbrush-load.c +++ b/app/core/gimpbrush-load.c @@ -344,6 +344,23 @@ gimp_brush_load_brush (GimpContext *context, } break; + case 3: + /* The obsolete .gbp format had a 3-byte pattern following a + * 1-byte brush, when embedded in a brush pipe, the current code + * tries to load that pattern as a brush, and encounters the '3' + * in the header. + */ + g_object_unref (brush); + g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ, + _("Fatal parse error in brush file '%s': " + "Unsupported brush depth %d\n" + "GIMP brushes must be GRAY or RGBA.\n" + "This might be an obsolete GIMP brush file, try " + "loading it as image and save it again."), + gimp_filename_to_utf8 (filename), header.bytes); + return NULL; + break; + case 4: { guchar buf[8 * 1024];