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

2017-11-27 Thread PanBian
On Mon, Nov 27, 2017 at 04:31:38AM +0100, Carl Eugen Hoyos wrote:
> 2017-11-27 4:22 GMT+01:00 Pan Bian :
> > 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.
> 
> Can't this break decoding of damaged streams that could be
> decoded so far?

Dear Eugen,

I see your consideration. I am not familar with the decoding logic.
Sorry for that. I sent this patch because I found that some other decode
functions (e.g. ff_hevc_decode_nal_vps) return error code
AVERROR_INVALIDDATA if overread occurs.

Thanks!

Pan Bian

> 
> Carl Eugen
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


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

2017-11-26 Thread Carl Eugen Hoyos
2017-11-27 4:22 GMT+01:00 Pan Bian :
> 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.

Can't this break decoding of damaged streams that could be
decoded so far?

Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


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

2017-11-26 Thread Pan Bian
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 
---
 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


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel