Skip to content

Commit

Permalink
Fixed a GIF decoding bug (divide by zero)
Browse files Browse the repository at this point in the history
Fixes issue #15
  • Loading branch information
jsummers committed Apr 14, 2017
1 parent 8656405 commit ca3356e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/imagew-gif.c
Expand Up @@ -614,6 +614,10 @@ static int iwgif_read_image(struct iwgifrcontext *rctx)


rctx->image_width = (int)iw_get_ui16le(&rctx->rbuf[4]); rctx->image_width = (int)iw_get_ui16le(&rctx->rbuf[4]);
rctx->image_height = (int)iw_get_ui16le(&rctx->rbuf[6]); rctx->image_height = (int)iw_get_ui16le(&rctx->rbuf[6]);
if(rctx->image_width<1 || rctx->image_height<1) {
iw_set_error(rctx->ctx, "Invalid image dimensions");
goto done;
}


rctx->interlaced = (int)((rctx->rbuf[8]>>6)&0x01); rctx->interlaced = (int)((rctx->rbuf[8]>>6)&0x01);


Expand Down

0 comments on commit ca3356e

Please sign in to comment.