From 66f3ae152346f84a5dce4427dffee1e097f6aabb Mon Sep 17 00:00:00 2001 From: Pu Cheng Date: Fri, 20 Nov 2026 07:52:54 +0800 Subject: [PATCH] decoder: Do not report stale reinit dimensions for too small sequences When a sequence is larger than the create-time maximum, impeg2d_dec_seq_hdr() returns IMPEG2D_UNSUPPORTED_DIMENSIONS and stores its size in u2_reinit_max_width/height, which the decode call reports as u4_pic_wd/ht so that the application can create a decoder of that size. The branches that reject a width or height below MIN_WIDTH/MIN_HEIGHT return the same error without writing these fields, so a decoder that had earlier seen an oversized sequence reported that sequence's size for the too small one (before or after IVD_CMD_CTL_RESET, which does not clear the fields either). A new decoder reports 0x0. Clear the reinit dimensions in the two too-small branches. --- decoder/impeg2d_dec_hdr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/decoder/impeg2d_dec_hdr.c b/decoder/impeg2d_dec_hdr.c index 9ef2be6..c42fb54 100644 --- a/decoder/impeg2d_dec_hdr.c +++ b/decoder/impeg2d_dec_hdr.c @@ -200,6 +200,8 @@ IMPEG2D_ERROR_CODES_T impeg2d_dec_seq_hdr(dec_state_t *ps_dec) else if((ps_dec->u2_horizontal_size < MIN_WIDTH) || (ps_dec->u2_vertical_size < MIN_HEIGHT)) { + ps_dec->u2_reinit_max_height = 0; + ps_dec->u2_reinit_max_width = 0; return IMPEG2D_UNSUPPORTED_DIMENSIONS; } else @@ -222,6 +224,8 @@ IMPEG2D_ERROR_CODES_T impeg2d_dec_seq_hdr(dec_state_t *ps_dec) if((ps_dec->u2_horizontal_size < MIN_WIDTH) || (ps_dec->u2_vertical_size < MIN_HEIGHT)) { + ps_dec->u2_reinit_max_height = 0; + ps_dec->u2_reinit_max_width = 0; return IMPEG2D_UNSUPPORTED_DIMENSIONS; }