[FFmpeg-devel] avcodec/hevc_ps: set correct return value

Pan Bian bianpan2016 at 163.com
Mon Nov 27 05:22:02 EET 2017


When the call to get_bits_left() fails, the return value is not an
negative error code. This patch explicitly assignes an error code to the
return variable ret.

Signed-off-by: Pan Bian <bianpan2016 at 163.com>
---
 libavcodec/hevc_ps.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index a4f7ed6..f87a577 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -1691,6 +1691,7 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx,
     if (get_bits_left(gb) < 0) {
         av_log(avctx, AV_LOG_ERROR,
                "Overread PPS by %d bits\n", -get_bits_left(gb));
+        ret = AVERROR_INVALIDDATA;
         goto err;
     }
 
-- 
1.9.1




More information about the ffmpeg-devel mailing list