[FFmpeg-cvslog] avcodec/h264_ps: Move truncation check from VUI to SPS

Michael Niedermayer git at videolan.org
Fri Apr 17 15:45:37 CEST 2015


ffmpeg | branch: release/2.5 | Michael Niedermayer <michaelni at gmx.at> | Wed Apr  8 22:18:35 2015 +0200| [6f02d93c0fbf29e717ef99ad36272c1958f34dc8] | committer: Michael Niedermayer

avcodec/h264_ps: Move truncation check from VUI to SPS

This more completely checks for truncation

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 32e06c485be94a4967bff87022cbb065d3cbfd0d)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6f02d93c0fbf29e717ef99ad36272c1958f34dc8
---

 libavcodec/h264_ps.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
index c2747ac..a9c199f 100644
--- a/libavcodec/h264_ps.c
+++ b/libavcodec/h264_ps.c
@@ -241,12 +241,6 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps)
         }
     }
 
-    if (get_bits_left(&h->gb) < 0) {
-        av_log(h->avctx, AV_LOG_ERROR,
-               "Overread VUI by %d bits\n", -get_bits_left(&h->gb));
-        return AVERROR_INVALIDDATA;
-    }
-
     return 0;
 }
 
@@ -523,6 +517,12 @@ int ff_h264_decode_seq_parameter_set(H264Context *h)
             goto fail;
     }
 
+    if (get_bits_left(&h->gb) < 0) {
+        av_log(h->avctx, AV_LOG_ERROR,
+               "Overread %s by %d bits\n", sps->vui_parameters_present_flag ? "VUI" : "SPS", -get_bits_left(&h->gb));
+        goto fail;
+    }
+
     if (!sps->sar.den)
         sps->sar.den = 1;
 



More information about the ffmpeg-cvslog mailing list