Skip to content
Permalink
Browse files Browse the repository at this point in the history
Block GIF images with a code size > 12 (Issue #463)
  • Loading branch information
michaelrsweet committed Jan 7, 2022
1 parent 7ca4694 commit 312f0f9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion htmldoc/image.cxx
Expand Up @@ -305,6 +305,12 @@ gif_read_image(FILE *fp, /* I - Input file */
pass = 0;
code_size = (uchar)getc(fp);

if (code_size > 12)
{
progress_error(HD_ERROR_READ_ERROR, "Bad GIF file \"%s\" - invalid code size %d.", img->filename, code_size);
return (-1);
}

if (gif_read_lzw(fp, 1, code_size) < 0)
return (-1);

Expand Down Expand Up @@ -432,7 +438,7 @@ gif_read_lzw(FILE *fp, /* I - File to read from */
if (sp > stack)
return (*--sp);

while ((code = gif_get_code (fp, code_size, 0)) >= 0)
while ((code = gif_get_code(fp, code_size, 0)) >= 0)
{
if (code == clear_code)
{
Expand Down

0 comments on commit 312f0f9

Please sign in to comment.