[FFmpeg-cvslog] h264_parse: make sure the ref count is zeroed on all failure paths
Anton Khirnov
git at videolan.org
Tue May 17 16:19:39 CEST 2016
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Mon Mar 21 16:50:11 2016 +0100| [71d3305c2711d4f6ec8b92db09ff64cf4e19a58e] | committer: Anton Khirnov
h264_parse: make sure the ref count is zeroed on all failure paths
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=71d3305c2711d4f6ec8b92db09ff64cf4e19a58e
---
libavcodec/h264_parse.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/libavcodec/h264_parse.c b/libavcodec/h264_parse.c
index 6230d67..bd1a50e 100644
--- a/libavcodec/h264_parse.c
+++ b/libavcodec/h264_parse.c
@@ -194,11 +194,11 @@ int ff_h264_parse_ref_count(int *plist_count, int ref_count[2],
if (num_ref_idx_active_override_flag) {
ref_count[0] = get_ue_golomb(gb) + 1;
if (ref_count[0] < 1)
- return AVERROR_INVALIDDATA;
+ goto fail;
if (slice_type_nos == AV_PICTURE_TYPE_B) {
ref_count[1] = get_ue_golomb(gb) + 1;
if (ref_count[1] < 1)
- return AVERROR_INVALIDDATA;
+ goto fail;
}
}
@@ -213,12 +213,15 @@ int ff_h264_parse_ref_count(int *plist_count, int ref_count[2],
max_refs = picture_structure == PICT_FRAME ? 16 : 32;
- if (ref_count[0] > max_refs || ref_count[1] > max_refs) {
- ref_count[0] = ref_count[1] = 0;
- return AVERROR_INVALIDDATA;
- }
+ if (ref_count[0] > max_refs || ref_count[1] > max_refs)
+ goto fail;
*plist_count = list_count;
return 0;
+fail:
+ *plist_count = 0;
+ ref_count[0] = 0;
+ ref_count[1] = 0;
+ return AVERROR_INVALIDDATA;
}
More information about the ffmpeg-cvslog
mailing list