X-Git-Url: https://git.draconx.ca/gitweb/liblbx.git/blobdiff_plain/2b32a2f8d9ab7bdc899bb04cac6fb73101400481..5c17ab8c0a5b2f66dac19031fd5394377cf375bb:/src/image.c diff --git a/src/image.c b/src/image.c index 27c8273..adc6a43 100644 --- a/src/image.c +++ b/src/image.c @@ -93,6 +93,12 @@ static struct lbx_image_priv *lbx_img_init(unsigned char hdr[static HDR_LEN]) if (img->flags & FLAG_LOOPING) img->pub.leadin = 0; + if (img->pub.leadin >= img->pub.frames) { + lbx_error_raise(LBX_EFORMAT); + free(img); + return NULL; + } + return img; } @@ -124,7 +130,6 @@ struct lbx_image *lbx_img_open(void *f, const struct lbx_file_ops *fops, */ _lbx_assert(img->wtf == 0); /* version? */ _lbx_assert(img->wtf2 == 0); /* very likely is simply reserved. */ - _lbx_assert(img->pub.frames > img->pub.leadin); _lbx_assert(!(img->flags & ~FLAG_ALL)); /* Read all offsets. Should be merged with identical code in lbx.c */