[FFmpeg-devel] [PATCH 4/9] avfilter/af_haas: validate par_m_source parameter

Michael Niedermayer michael at niedermayer.cc
Wed Nov 8 22:11:45 EET 2017


On Wed, Nov 08, 2017 at 07:17:48PM +0100, Timo Rothenpieler wrote:
> Fixes CID #1417663
> ---
>  libavfilter/af_haas.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavfilter/af_haas.c b/libavfilter/af_haas.c
> index 691c251f54..fac4b6cf2f 100644
> --- a/libavfilter/af_haas.c
> +++ b/libavfilter/af_haas.c
> @@ -162,6 +162,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
>          case 1: mid = src[1]; break;
>          case 2: mid = (src[0] + src[1]) * 0.5; break;
>          case 3: mid = (src[0] - src[1]) * 0.5; break;
> +        default: return AVERROR(EINVAL);
>          }

This condition is impossible, which makes this a false positive and
it should be marked as such.
you can add a av_assert if you want to ensure future changes to the
code do not add a codepath that can trigger this

the return is unreachable and the next generation of static analyzer
will flag that as dead code

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20171108/d16a1fe7/attachment.sig>


More information about the ffmpeg-devel mailing list