$NetBSD: patch-ak,v 1.1 2005/04/01 11:37:23 salo Exp $ --- gdk-pixbuf/io-bmp.c.orig 2002-09-27 23:12:40.000000000 +0200 +++ gdk-pixbuf/io-bmp.c 2005-04-01 13:05:14.000000000 +0200 @@ -245,7 +245,14 @@ 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;