Message ID | 20171108181753.6776-5-timo@rothenpieler.org |
---|---|
State | New |
Headers | show |
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 [...]
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); } mid *= level_in;