diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-04-20 22:49:50 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-04-20 22:49:50 +0200 |
commit | 037c9c25e6213852e33de5b6e00bbf9d26195938 (patch) | |
tree | f8c70a3f54015dfe015a1d93670bc846c67c7ebe /libavcodec/h264_ps.c | |
parent | e6831c087e49157b64255388cc1bfdb60c76d79e (diff) | |
parent | 86e1a35802df42f51337d3fed8d5d99d0898c8bf (diff) | |
download | ffmpeg-037c9c25e6213852e33de5b6e00bbf9d26195938.tar.gz |
Merge commit '86e1a35802df42f51337d3fed8d5d99d0898c8bf'
* commit '86e1a35802df42f51337d3fed8d5d99d0898c8bf':
h264_ps: Return meaningful error codes and address a memory leak
Conflicts:
libavcodec/h264_ps.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/h264_ps.c')
-rw-r--r-- | libavcodec/h264_ps.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c index 0d384dda22..ae1b60a45b 100644 --- a/libavcodec/h264_ps.c +++ b/libavcodec/h264_ps.c @@ -559,7 +559,7 @@ int ff_h264_decode_seq_parameter_set(H264Context *h, int ignore_truncation) fail: av_free(sps); - return -1; + return AVERROR_INVALIDDATA; } static void build_qp_table(PPS *pps, int t, int index, const int depth) @@ -593,6 +593,7 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length) PPS *pps; int qp_bd_offset; int bits_left; + int ret; if (pps_id >= MAX_PPS_COUNT) { av_log(h->avctx, AV_LOG_ERROR, "pps_id %u out of range\n", pps_id); @@ -606,6 +607,7 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length) if ((unsigned)pps->sps_id >= MAX_SPS_COUNT || !h->sps_buffers[pps->sps_id]) { av_log(h->avctx, AV_LOG_ERROR, "sps_id %u out of range\n", pps->sps_id); + ret = AVERROR_INVALIDDATA; goto fail; } sps = h->sps_buffers[pps->sps_id]; @@ -613,11 +615,13 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length) av_log(h->avctx, AV_LOG_ERROR, "Invalid luma bit depth=%d\n", sps->bit_depth_luma); + ret = AVERROR_INVALIDDATA; goto fail; } else if (sps->bit_depth_luma == 11 || sps->bit_depth_luma == 13) { av_log(h->avctx, AV_LOG_ERROR, "Unimplemented luma bit depth=%d\n", sps->bit_depth_luma); + ret = AVERROR_PATCHWELCOME; goto fail; } @@ -663,6 +667,7 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length) pps->ref_count[1] = get_ue_golomb(&h->gb) + 1; if (pps->ref_count[0] - 1 > 32 - 1 || pps->ref_count[1] - 1 > 32 - 1) { av_log(h->avctx, AV_LOG_ERROR, "reference overflow (pps)\n"); + ret = AVERROR_INVALIDDATA; goto fail; } @@ -724,5 +729,5 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length) fail: av_free(pps); - return -1; + return ret; } |