[gdk-pixbuf] io-ico: Add an assertion to clarify buffer management
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdk-pixbuf] io-ico: Add an assertion to clarify buffer management
- Date: Thu, 3 Aug 2017 11:48:18 +0000 (UTC)
commit 48accc7397d6802f3faa0fb9a4024babc980a09a
Author: Philip Withnall <withnall endlessm com>
Date: Wed Feb 8 09:34:33 2017 +0000
io-ico: Add an assertion to clarify buffer management
The code is correct (the line buffer is set when DecodeHeader() returns
successfully with a non-zero-length line), but that’s not at all obvious
from the code, and is tripping Coverity up. Add an assertion to make it
clearer.
Coverity ID: 1400057
https://bugzilla.gnome.org/show_bug.cgi?id=778943
gdk-pixbuf/io-ico.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/gdk-pixbuf/io-ico.c b/gdk-pixbuf/io-ico.c
index 32e4c69..8729a0f 100644
--- a/gdk-pixbuf/io-ico.c
+++ b/gdk-pixbuf/io-ico.c
@@ -950,6 +950,9 @@ gdk_pixbuf__ico_image_load_increment(gpointer data,
BytesToCopy = size;
if (BytesToCopy > 0) {
+ /* Should be non-NULL once the header is decoded, as below. */
+ g_assert (context->LineBuf != NULL);
+
memmove(context->LineBuf +
context->LineDone, buf,
BytesToCopy);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]