$NetBSD$

--- gdk-pixbuf/io-gif.c.orig	2002-12-18 19:49:01.000000000 +0000
+++ gdk-pixbuf/io-gif.c
@@ -617,7 +617,7 @@ clip_frame (GifContext *context, int *x,
 	*w = MIN (context->width, context->x_offset + context->frame_len) - *x;
 	*h = MIN (context->height, context->y_offset + context->frame_height) - *y;
 
-	if (w > 0 && h > 0)
+	if (*w > 0 && *h > 0)
 		return;
 
 	/* The frame is completely off-bounds */
@@ -944,6 +944,10 @@ gif_prepare_lzw (GifContext *context)
 		return -1;
 	}
 
+	if (context->lzw_set_code_size > MAX_LZW_BITS) {
+		return -1;
+	}
+
 	context->lzw_code_size = context->lzw_set_code_size + 1;
 	context->lzw_clear_code = 1 << context->lzw_set_code_size;
 	context->lzw_end_code = context->lzw_clear_code + 1;
