diff --git a/release/c/wuffs-unsupported-snapshot.c b/release/c/wuffs-unsupported-snapshot.c index 662063b8..72cd6380 100644 --- a/release/c/wuffs-unsupported-snapshot.c +++ b/release/c/wuffs-unsupported-snapshot.c @@ -16121,6 +16121,17 @@ wuffs_wbmp__decoder__decode_frame_config(wuffs_wbmp__decoder* self, self->private_impl.active_coroutine = 0; wuffs_base__status status = wuffs_base__make_status(NULL); + uint8_t* iop_a_src = NULL; + uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL; + uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL; + uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL; + if (a_src) { + io0_a_src = a_src->data.ptr; + io1_a_src = io0_a_src + a_src->meta.ri; + iop_a_src = io1_a_src; + io2_a_src = io0_a_src + a_src->meta.wi; + } + uint32_t coro_susp_point = self->private_impl.p_decode_frame_config[0]; if (coro_susp_point) { } @@ -16128,15 +16139,33 @@ wuffs_wbmp__decoder__decode_frame_config(wuffs_wbmp__decoder* self, WUFFS_BASE__COROUTINE_SUSPENSION_POINT_0; if (self->private_impl.f_call_sequence < 1) { + if (a_src) { + a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr)); + } WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1); status = wuffs_wbmp__decoder__decode_image_config(self, NULL, a_src); + if (a_src) { + iop_a_src = a_src->data.ptr + a_src->meta.ri; + } if (status.repr) { goto suspend; } } else if (self->private_impl.f_call_sequence == 1) { + if (self->private_impl.f_frame_config_io_position != + wuffs_base__u64__sat_add(a_src->meta.pos, + ((uint64_t)(iop_a_src - io0_a_src)))) { + status = wuffs_base__make_status(wuffs_base__error__bad_restart); + goto exit; + } } else if (self->private_impl.f_call_sequence == 2) { + if (a_src) { + a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr)); + } WUFFS_BASE__COROUTINE_SUSPENSION_POINT(2); status = wuffs_wbmp__decoder__skip_frame(self, a_src); + if (a_src) { + iop_a_src = a_src->data.ptr + a_src->meta.ri; + } if (status.repr) { goto suspend; } @@ -16172,6 +16201,10 @@ suspend: goto exit; exit: + if (a_src) { + a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr)); + } + if (wuffs_base__status__is_error(&status)) { self->private_impl.magic = WUFFS_BASE__DISABLED; } diff --git a/std/wbmp/decode_wbmp.wuffs b/std/wbmp/decode_wbmp.wuffs index ed2306cc..e0f5486d 100644 --- a/std/wbmp/decode_wbmp.wuffs +++ b/std/wbmp/decode_wbmp.wuffs @@ -97,7 +97,9 @@ pub func decoder.decode_frame_config?(dst: nptr base.frame_config, src: base.io_ if this.call_sequence < 1 { this.decode_image_config?(dst: nullptr, src: args.src) } else if this.call_sequence == 1 { - // No-op. + if this.frame_config_io_position <> args.src.position() { + return base."#bad restart" + } } else if this.call_sequence == 2 { this.skip_frame?(src: args.src) return base."@end of data"