Make the GIF dirty_rect be in the frame_rect

Updates https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11823
This commit is contained in:
Nigel Tao committed 2019-02-09 13:56:24 +11:00
1 parent f8daf3d219
commit 0842bc7115
4 files changed
+51 -9

No files matched your search

+10 -3
View File
@@ -132,7 +132,6 @@ pub func decoder.decode_image_config?(dst nptr base.image_config, src base.io_re
if this.call_sequence >= 1 {
return base."?bad call sequence"
}
this.dirty_y.reset!()
this.decode_header?(src:args.src)
this.decode_lsd?(src:args.src)
@@ -177,10 +176,16 @@ pub func decoder.num_decoded_frames() base.u64 {
}
pub func decoder.frame_dirty_rect() base.rect_ie_u32 {
// TODO: intersect this with the frame_rect? In theory, that should be
// unnecessary, and could hide bugs, but it'd be a cheap way to ensure that
// the dirty_rect is inside the frame_rect.
//
// Note that this method is pure, so it cannot set a sticky error bit if
// the dirty_rect is too big.
return this.util.make_rect_ie_u32(
min_incl_x:this.frame_rect_x0,
min_incl_x:this.frame_rect_x0.min(x:this.width),
min_incl_y:this.dirty_y.get_min_incl(),
max_excl_x:this.frame_rect_x1,
max_excl_x:this.frame_rect_x1.min(x:this.width),
max_excl_y:this.dirty_y.get_max_excl())
}
@@ -206,6 +211,8 @@ pub func decoder.restart_frame!(index base.u64, io_position base.u64) base.statu
pub func decoder.decode_frame_config?(dst nptr base.frame_config, src base.io_reader) {
var blend base.u8
this.dirty_y.reset!()
if not this.end_of_data {
if this.call_sequence == 0 {
this.decode_image_config?(dst:nullptr, src:args.src)