avcodec/aacdec_fixed: use 64bit to avoid overflow in rounding in apply_dependent_coup...
[ffmpeg.git] / libavcodec / roqvideo.c
index cc24133..8eda93c 100644 (file)
@@ -20,8 +20,8 @@
  */
 
 /**
- * @file roqvideo.c
- * Id RoQ Video common functions based on work by Dr. Tim Ferguson
+ * @file
+ * id RoQ Video common functions based on work by Dr. Tim Ferguson
  */
 
 #include "avcodec.h"
@@ -115,11 +115,16 @@ static inline void apply_motion_generic(RoqContext *ri, int x, int y, int deltax
         return;
     }
 
+    if (!ri->last_frame->data[0]) {
+        av_log(ri->avctx, AV_LOG_ERROR, "Invalid decode type. Invalid header?\n");
+        return;
+    }
+
     for(cp = 0; cp < 3; cp++) {
         int outstride = ri->current_frame->linesize[cp];
         int instride  = ri->last_frame   ->linesize[cp];
-        block_copy(ri->current_frame->data[cp] + (y*outstride) + x,
-                   ri->last_frame->data[cp] + (my*instride) + mx,
+        block_copy(ri->current_frame->data[cp] + y*outstride + x,
+                   ri->last_frame->data[cp] + my*instride + mx,
                    outstride, instride, sz);
     }
 }