[gimp/gimp-2-10] Issue #1783 - Xcf file crashing gimp-console-2.10 ...
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] Issue #1783 - Xcf file crashing gimp-console-2.10 ...
- Date: Fri, 6 Jul 2018 00:39:16 +0000 (UTC)
commit d5e1af7d52a6c155cc5532406ec494aad84ba564
Author: Ell <ell_se yahoo com>
Date: Thu Jul 5 20:19:40 2018 -0400
Issue #1783 - Xcf file crashing gimp-console-2.10 ...
... (Invalid read reported by valgrind)
In xcf_read_int8(), avoid calling g_input_stream_read_all() with
data == NULL and count == 0, in which case it raises a CRITICAL and
doesn't set bytes_read, which we proceed to use uninitialized.
This can happen, e.g., when reading an empty parasite.
(cherry picked from commit 6ebadea7c142c9601d96254ae2ddded521b1065d)
app/xcf/xcf-read.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/app/xcf/xcf-read.c b/app/xcf/xcf-read.c
index 420da7040f..2c281a87bf 100644
--- a/app/xcf/xcf-read.c
+++ b/app/xcf/xcf-read.c
@@ -37,12 +37,18 @@ xcf_read_int8 (XcfInfo *info,
guint8 *data,
gint count)
{
- gsize bytes_read;
+ gsize bytes_read = 0;
- g_input_stream_read_all (info->input, data, count,
- &bytes_read, NULL, NULL);
+ /* we allow for 'data == NULL && count == 0', which g_input_stream_read_all()
+ * rejects.
+ */
+ if (count > 0)
+ {
+ g_input_stream_read_all (info->input, data, count,
+ &bytes_read, NULL, NULL);
- info->cp += bytes_read;
+ info->cp += bytes_read;
+ }
return bytes_read;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]