[FFmpeg-cvslog] nuv: check per-frame header for validity.

Reimar Döffinger git at videolan.org
Sun Nov 27 00:39:11 CET 2011


ffmpeg | branch: master | Reimar Döffinger <Reimar.Doeffinger at gmx.de> | Sat Nov  5 23:13:07 2011 +0100| [f6afacdb3b708720c9fb85984b4f7fdbca2b2036] | committer: Anton Khirnov

nuv: check per-frame header for validity.

Since it contains dimensions parsing an invalid one has rather
annoying effects.

Signed-off-by: Anton Khirnov <anton at khirnov.net>

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

 libavcodec/nuv.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c
index 7bace2e..94962b5 100644
--- a/libavcodec/nuv.c
+++ b/libavcodec/nuv.c
@@ -184,9 +184,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
     }
     if (c->codec_frameheader) {
         int w, h, q;
-        if (buf_size < 12) {
-            av_log(avctx, AV_LOG_ERROR, "invalid nuv video frame\n");
-            return -1;
+        if (buf[0] != 'V' || buf_size < 12) {
+            av_log(avctx, AV_LOG_ERROR, "invalid nuv video frame (wrong codec_tag?)\n");
+            return AVERROR_INVALIDDATA;
         }
         w = AV_RL16(&buf[6]);
         h = AV_RL16(&buf[8]);



More information about the ffmpeg-cvslog mailing list