Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: mkver via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: mkver <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] avcodec/pngenc: Mark unreachable default switch cases as such (PR #20641)
Date: Thu, 02 Oct 2025 22:21:49 -0000
Message-ID: <175944370986.69.17679295915357367876@bf249f23a2c8> (raw)

PR #20641 opened by mkver
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20641
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20641.patch


>From 2eb23623c006631e4201e57360a70f2d30a72da9 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Thu, 2 Oct 2025 21:07:48 +0200
Subject: [PATCH] avcodec/pngenc: Mark unreachable default switch cases as such

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/pngenc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c
index 5baad9aad5..8e4f42125e 100644
--- a/libavcodec/pngenc.c
+++ b/libavcodec/pngenc.c
@@ -195,6 +195,8 @@ static void png_filter_row(PNGEncContext *c, uint8_t *dst, int filter_type,
             dst[i] = src[i] - top[i];
         sub_png_paeth_prediction(dst + i, src + i, top + i, size - i, bpp);
         break;
+    default:
+        av_unreachable("PNG_FILTER_VALUE_MIXED can't happen here and all others are covered");
     }
 }
 
@@ -816,6 +818,9 @@ static int apng_do_inverse_blend(AVFrame *output, const AVFrame *input,
                         palette[*background] >> 24 == 0)
                         break;
                     return -1;
+
+                default:
+                    av_unreachable("Pixfmt has been checked before");
                 }
 
                 memmove(output_data, foreground, bpp);
@@ -1193,7 +1198,7 @@ static av_cold int png_enc_init(AVCodecContext *avctx)
         s->color_type = PNG_COLOR_TYPE_PALETTE;
         break;
     default:
-        return -1;
+        av_unreachable("Already checked via CODEC_PIXFMTS");
     }
     s->bits_per_pixel = ff_png_get_nb_channels(s->color_type) * s->bit_depth;
 
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

                 reply	other threads:[~2025-10-02 22:22 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=175944370986.69.17679295915357367876@bf249f23a2c8 \
    --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 http://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/ http://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