changeset 9855:756ac43c7fd9 libavcodec

check if frame size matches old sys and assumes corrupted input, fixes #1192
author bcoudurier
date Sun, 14 Jun 2009 22:34:28 +0000
parents 2428d32533f6
children ff2358195bc7
files dv.c dvdata.h
diffstat 2 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dv.c	Sun Jun 14 09:55:28 2009 +0000
+++ b/dv.c	Sun Jun 14 22:34:28 2009 +0000
@@ -1119,7 +1119,7 @@
     int buf_size = avpkt->size;
     DVVideoContext *s = avctx->priv_data;
 
-    s->sys = dv_frame_profile(buf);
+    s->sys = dv_frame_profile(s->sys, buf, buf_size);
     if (!s->sys || buf_size < s->sys->frame_size || dv_init_dynamic_tables(s->sys))
         return -1; /* NOTE: we only accept several full frames */
 
--- a/dvdata.h	Sun Jun 14 09:55:28 2009 +0000
+++ b/dvdata.h	Sun Jun 14 22:34:28 2009 +0000
@@ -698,7 +698,9 @@
  */
 #define DV_MAX_BPM 8
 
-static inline const DVprofile* dv_frame_profile(const uint8_t* frame)
+static inline
+const DVprofile* dv_frame_profile(const DVprofile *sys,
+                                  const uint8_t* frame, unsigned buf_size)
 {
    int i;
 
@@ -715,6 +717,10 @@
        if (dsf == dv_profiles[i].dsf && stype == dv_profiles[i].video_stype)
            return &dv_profiles[i];
 
+   /* check if old sys matches and assumes corrupted input */
+   if (sys && buf_size == sys->frame_size)
+       return sys;
+
    return NULL;
 }