From: rzumer via ffmpeg-devel <ffmpeg-devel@ffmpeg.org> To: ffmpeg-devel@ffmpeg.org Cc: rzumer <code@ffmpeg.org> Subject: [FFmpeg-devel] [PATCH] avcodec/webp: fix incorrectly returning AVERROR_INVALIDDATA when building Huffman reader (PR #20316) Date: Fri, 22 Aug 2025 20:38:27 +0300 (EEST) Message-ID: <20250822173827.70D9E68E6BE@ffbox0-bg.ffmpeg.org> (raw) PR #20316 opened by rzumer URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20316 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20316.patch This corrects an error in commit c33f16d, causing the single-symbol special case to fall through to the no-symbol one and returning AVERROR_INVALIDDATA instead of a success status code. Since the same commit removes shared logic between the two special cases, I split them up to simplify it as a follow-up. From c031ae60335ed0f02b5b8c80a069656b68f66b68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Zumer?= <rzumer@tebako.net> Date: Fri, 22 Aug 2025 12:44:09 -0400 Subject: [PATCH 1/2] avcodec/webp: fix incorrectly returning AVERROR_INVALIDDATA when building Huffman reader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This corrects an error in commit c33f16d. Signed-off-by: Raphaël Zumer <rzumer@tebako.net> --- libavcodec/webp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/webp.c b/libavcodec/webp.c index 56c3ec6d28..a350dff7a7 100644 --- a/libavcodec/webp.c +++ b/libavcodec/webp.c @@ -281,6 +281,7 @@ static int huff_reader_build_canonical(HuffReader *r, const uint8_t *code_length r->nb_symbols = 1; r->simple = 1; r->simple_symbols[0] = syms[0]; + return 0; } // No symbols return AVERROR_INVALIDDATA; -- 2.49.1 From 037814053f5cc47f07401bc6764bdc15d92fd70c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Zumer?= <rzumer@tebako.net> Date: Fri, 22 Aug 2025 13:32:48 -0400 Subject: [PATCH 2/2] avcodec/webp: simplify special-case handling when building Huffman reader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raphaël Zumer <rzumer@tebako.net> --- libavcodec/webp.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/libavcodec/webp.c b/libavcodec/webp.c index a350dff7a7..c1c35fded0 100644 --- a/libavcodec/webp.c +++ b/libavcodec/webp.c @@ -275,17 +275,19 @@ static int huff_reader_build_canonical(HuffReader *r, const uint8_t *code_length lens[idx] = code_lengths[sym]; } } - if (nb_codes <= 1) { - if (nb_codes == 1) { - /* special-case 1 symbol since the vlc reader cannot handle it */ - r->nb_symbols = 1; - r->simple = 1; - r->simple_symbols[0] = syms[0]; - return 0; - } + + if (nb_codes == 0) { // No symbols return AVERROR_INVALIDDATA; } + if (nb_codes == 1) { + // Special-case 1 symbol since the VLC reader cannot handle it + r->nb_symbols = 1; + r->simple = 1; + r->simple_symbols[0] = syms[0]; + return 0; + } + ret = ff_vlc_init_from_lengths(&r->vlc, 8, nb_codes, lens, 1, syms, 2, 2, 0, VLC_INIT_OUTPUT_LE, logctx); if (ret < 0) -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
reply other threads:[~2025-08-22 17:38 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20250822173827.70D9E68E6BE@ffbox0-bg.ffmpeg.org \ --to=ffmpeg-devel@ffmpeg.org \ --cc=code@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git