/*
- * "$Id: image-gif.c 5509 2006-05-11 11:41:36Z mike $"
+ * "$Id: image-gif.c 7420 2008-04-01 20:32:00Z mike $"
*
* GIF image routines for the Common UNIX Printing System (CUPS).
*
- * Copyright 1993-2006 by Easy Software Products.
+ * Copyright 2007-2008 by Apple Inc.
+ * Copyright 1993-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
- * property of Easy Software Products and are protected by Federal
- * copyright law. Distribution and use rights are outlined in the file
- * "LICENSE.txt" which should have been included with this file. If this
- * file is missing or damaged please contact Easy Software Products
- * at:
- *
- * Attn: CUPS Licensing Information
- * Easy Software Products
- * 44141 Airport View Drive, Suite 204
- * Hollywood, Maryland 20636 USA
- *
- * Voice: (301) 373-9600
- * EMail: cups-info@cups.org
- * WWW: http://www.cups.org
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*
#define GIF_INTERLACE 0x40
#define GIF_COLORMAP 0x80
+#define GIF_MAX_BITS 12
typedef cups_ib_t gif_cmap_t[256][4];
typedef short gif_table_t[4096];
if (img->xsize == 0 || img->ysize == 0)
{
- fprintf(stderr, "ERROR: Bad GIF image dimensions: %dx%d\n",
+ fprintf(stderr, "DEBUG: Bad GIF image dimensions: %dx%d\n",
img->xsize, img->ysize);
fclose(fp);
return (1);
pass = 0;
code_size = getc(fp);
+ if (code_size > GIF_MAX_BITS || !pixels)
+ return (-1);
+
if (gif_read_lzw(fp, 1, code_size) < 0)
+ {
+ free(pixels);
return (-1);
+ }
temp = pixels;
while ((pixel = gif_read_lzw(fp, 0, code_size)) >= 0)
/*
- * End of "$Id: image-gif.c 5509 2006-05-11 11:41:36Z mike $".
+ * End of "$Id: image-gif.c 7420 2008-04-01 20:32:00Z mike $".
*/