openbsd-ports/graphics/gdk-pixbuf/patches/patch-gdk-pixbuf_io-bmp_c
2009-01-09 16:13:22 +00:00

33 lines
876 B
Plaintext

$OpenBSD: patch-gdk-pixbuf_io-bmp_c,v 1.3 2009/01/09 16:13:22 naddy Exp $
--- gdk-pixbuf/io-bmp.c.orig Fri Sep 27 23:12:40 2002
+++ gdk-pixbuf/io-bmp.c Fri Jan 9 17:12:25 2009
@@ -245,7 +245,15 @@ lsb_16 (guchar *src)
static gboolean
grow_buffer (struct bmp_progressive_state *State)
{
- guchar *tmp = realloc (State->buff, State->BufferSize);
+ guchar *tmp;
+
+ if (State->BufferSize == 0) {
+ State->read_state = READ_STATE_ERROR;
+ return FALSE;
+ }
+
+ tmp = realloc (State->buff, State->BufferSize);
+
if (!tmp) {
State->read_state = READ_STATE_ERROR;
return FALSE;
@@ -870,8 +878,10 @@ DoCompressed(struct bmp_progressive_state *context)
guchar c;
gint idx;
- if (context->compr.y >= context->Header.height)
+ if (context->compr.y >= context->Header.height) {
+ context->BufferDone = 0;
return TRUE;
+ }
y = context->compr.y;