if (length != 0)
repeat=p[0];
- if (repeat == 3)
+ if (repeat == 3 && length > 8)
{
final_delay=(png_uint_32) mng_get_long(&p[2]);
mng_iterations=(png_uint_32) mng_get_long(&p[6]);
change_clipping=(*p++);
p++; /* change_sync */
- if (change_delay)
+ if (change_delay && ((p-chunk) < (ssize_t) (length-4)))
{
frame_delay=1UL*image->ticks_per_second*
mng_get_long(p);
" Framing_delay=%.20g",(double) frame_delay);
}
- if (change_timeout)
+ if (change_timeout && ((p-chunk) < (ssize_t) (length-4)))
{
frame_timeout=1UL*image->ticks_per_second*
mng_get_long(p);
" Framing_timeout=%.20g",(double) frame_timeout);
}
- if (change_clipping)
+ if (change_clipping && ((p-chunk) < (ssize_t) (length-16)))
{
fb=mng_read_box(previous_fb,(char) p[0],&p[1]);
p+=17;