aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-09-07 01:42:28 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-09-20 18:40:33 +0200
commit9e1ce9a8eee17f741e3cff5c8018c42eddf8c99b (patch)
tree904ae4b7941c3c133dcf0dfac46228395e5c27d0
parentb4d2888ce8d15818b7d839e3bc0ec8e9cca17615 (diff)
downloadffmpeg-9e1ce9a8eee17f741e3cff5c8018c42eddf8c99b.tar.gz
avcodec/h264: Allow partial escaping
Fixes Ticket3923 Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 033a5334badd8af48f13c6fd1e6827f8e3f2c2f3) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/h264.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 5db5c76daa..82272841f4 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -634,7 +634,7 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src,
#define STARTCODE_TEST \
if (i + 2 < length && src[i + 1] == 0 && src[i + 2] <= 3) { \
- if (src[i + 2] != 3) { \
+ if (src[i + 2] != 3 && src[i + 2] != 0) { \
/* startcode, so we must be past the end */ \
length = i; \
} \
@@ -707,7 +707,7 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src,
if (src[si + 2] > 3) {
dst[di++] = src[si++];
dst[di++] = src[si++];
- } else if (src[si] == 0 && src[si + 1] == 0) {
+ } else if (src[si] == 0 && src[si + 1] == 0 && src[si + 2] != 0) {
if (src[si + 2] == 3) { // escape
dst[di++] = 0;
dst[di++] = 0;