diff mbox series

[FFmpeg-devel,1/2] avcodec/gdv: Remove dead check

Message ID 20201107010603.552387-1-andreas.rheinhardt@gmail.com
State Accepted
Commit 7e8306dd2da54fa499ea79a74f0ba81507e6c9d4
Headers show
Series [FFmpeg-devel,1/2] avcodec/gdv: Remove dead check | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Nov. 7, 2020, 1:06 a.m. UTC
At the end of its decode function, the decoder sets *got_frame to 1 and
then checks whether ret is < 0; if so, it is returned, otherwise
avpkt->size is. But it is impossible for ret to be < 0 here and if it
were, it would be nonsense to set *got_frame to 1 before this. Therefore
just return avpkt->size unconditionally.

Fixes Coverity issue #1439730.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/gdv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paul B Mahol Nov. 7, 2020, 9:44 a.m. UTC | #1
lgtm

On Sat, Nov 7, 2020 at 2:30 AM Andreas Rheinhardt <
andreas.rheinhardt@gmail.com> wrote:

> At the end of its decode function, the decoder sets *got_frame to 1 and
> then checks whether ret is < 0; if so, it is returned, otherwise
> avpkt->size is. But it is impossible for ret to be < 0 here and if it
> were, it would be nonsense to set *got_frame to 1 before this. Therefore
> just return avpkt->size unconditionally.
>
> Fixes Coverity issue #1439730.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavcodec/gdv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/gdv.c b/libavcodec/gdv.c
> index f00f3ac145..2be1e2ea7f 100644
> --- a/libavcodec/gdv.c
> +++ b/libavcodec/gdv.c
> @@ -551,7 +551,7 @@ static int gdv_decode_frame(AVCodecContext *avctx,
> void *data,
>
>      *got_frame = 1;
>
> -    return ret < 0 ? ret : avpkt->size;
> +    return avpkt->size;
>  }
>
>  static av_cold int gdv_decode_close(AVCodecContext *avctx)
> --
> 2.25.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".
diff mbox series

Patch

diff --git a/libavcodec/gdv.c b/libavcodec/gdv.c
index f00f3ac145..2be1e2ea7f 100644
--- a/libavcodec/gdv.c
+++ b/libavcodec/gdv.c
@@ -551,7 +551,7 @@  static int gdv_decode_frame(AVCodecContext *avctx, void *data,
 
     *got_frame = 1;
 
-    return ret < 0 ? ret : avpkt->size;
+    return avpkt->size;
 }
 
 static av_cold int gdv_decode_close(AVCodecContext *avctx)