diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2016-08-20 00:39:07 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-08-25 03:29:36 +0200 |
commit | ec30a498e66a6498c3c5045244aec9a38d41799e (patch) | |
tree | 00d8078f74d71f1dcbfef7761c89329e7b4cf091 | |
parent | fabc1c9e567df696c87b557bc156e92420b26fa0 (diff) | |
download | ffmpeg-ec30a498e66a6498c3c5045244aec9a38d41799e.tar.gz |
avcodec/h2645_parse: Use get_nalsize() in ff_h2645_packet_split()
This fixes several regressions in h.264
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 528171ba84b24830b74d9c19dd957ac3609f7270)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/h2645_parse.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c index e92e38a722..00594371c0 100644 --- a/libavcodec/h2645_parse.c +++ b/libavcodec/h2645_parse.c @@ -260,16 +260,15 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length, int skip_trailing_zeros = 1; if (buf == next_avc) { - int i; - for (i = 0; i < nal_length_size; i++) - extract_length = (extract_length << 8) | buf[i]; + int i = 0; + extract_length = get_nalsize(nal_length_size, + buf, length, &i, logctx); + if (extract_length < 0) + return extract_length; + buf += nal_length_size; length -= nal_length_size; - if (extract_length > length) { - av_log(logctx, AV_LOG_ERROR, "Invalid NAL unit size.\n"); - return AVERROR_INVALIDDATA; - } next_avc = buf + extract_length; } else { if (buf > next_avc) |