aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2016-07-07 20:18:26 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2016-08-25 03:29:36 +0200
commitfabc1c9e567df696c87b557bc156e92420b26fa0 (patch)
treec4cf13d79982ef9d51aae9874f847bc69690389a
parent0ad4d4198a40f3907b77390d525bf6fd7868538f (diff)
downloadffmpeg-fabc1c9e567df696c87b557bc156e92420b26fa0.tar.gz
h2645_parse: only read avc length code at the correct position
Reading it from any other position would result in a wrong size being read, instead fallback to the re-sync mechanic in the else clause. (cherry picked from commit c3e9b098e12b8932693361625d4a69bc30583d9a) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/h2645_parse.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c
index 4d18de8b75..e92e38a722 100644
--- a/libavcodec/h2645_parse.c
+++ b/libavcodec/h2645_parse.c
@@ -259,7 +259,7 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
int extract_length = 0;
int skip_trailing_zeros = 1;
- if (buf >= next_avc) {
+ if (buf == next_avc) {
int i;
for (i = 0; i < nal_length_size; i++)
extract_length = (extract_length << 8) | buf[i];
@@ -272,6 +272,9 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
}
next_avc = buf + extract_length;
} else {
+ if (buf > next_avc)
+ av_log(logctx, AV_LOG_WARNING, "Exceeded next NALFF position, re-syncing.\n");
+
/* search start code */
while (buf[0] != 0 || buf[1] != 0 || buf[2] != 1) {
++buf;