[FFmpeg-cvslog] avcodec: add emuedge_linesize_type

Michael Niedermayer git at videolan.org
Sat Sep 7 14:36:18 CEST 2013


ffmpeg | branch: release/1.1 | Michael Niedermayer <michaelni at gmx.at> | Wed Sep  4 14:22:20 2013 +0200| [87908de715c2f7e898cfebbb78edca346d18b155] | committer: Michael Niedermayer

avcodec: add emuedge_linesize_type

Currently all uses of the emu edge code as well as the code itself
assume int linesize
changing some but not changing all would introduce a security issue
once all use this typedef a simple search and replace can be
done to switch them all to ptrdiff_t

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

Conflicts:

	libavcodec/videodsp.h

Merged-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/mpegvideo_motion.c  |    3 ++-
 libavcodec/videodsp.h          |    2 ++
 libavcodec/videodsp_template.c |    2 +-
 libavcodec/x86/videodsp_init.c |    2 +-
 4 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c
index 22381de..3e0211b 100644
--- a/libavcodec/mpegvideo_motion.c
+++ b/libavcodec/mpegvideo_motion.c
@@ -215,7 +215,8 @@ void mpeg_motion_internal(MpegEncContext *s,
 {
     uint8_t *ptr_y, *ptr_cb, *ptr_cr;
     int dxy, uvdxy, mx, my, src_x, src_y,
-        uvsrc_x, uvsrc_y, v_edge_pos, uvlinesize, linesize;
+        uvsrc_x, uvsrc_y, v_edge_pos;
+    emuedge_linesize_type uvlinesize, linesize;
 
 #if 0
 if(s->quarter_sample)
diff --git a/libavcodec/videodsp.h b/libavcodec/videodsp.h
index dc89384..5a79e66 100644
--- a/libavcodec/videodsp.h
+++ b/libavcodec/videodsp.h
@@ -29,6 +29,8 @@
 #include <stddef.h>
 #include <stdint.h>
 
+typedef int emuedge_linesize_type;
+
 typedef struct VideoDSPContext {
     /**
      * Copy a rectangular area of samples to a temporary buffer and replicate
diff --git a/libavcodec/videodsp_template.c b/libavcodec/videodsp_template.c
index 44f6a4d..1f709c4 100644
--- a/libavcodec/videodsp_template.c
+++ b/libavcodec/videodsp_template.c
@@ -27,7 +27,7 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
 {
     int x, y;
     int start_y, start_x, end_y, end_x;
-    int linesize = linesize_arg;
+    emuedge_linesize_type linesize = linesize_arg;
 
     if (!w || !h)
         return;
diff --git a/libavcodec/x86/videodsp_init.c b/libavcodec/x86/videodsp_init.c
index 4a8b244..bbf9464 100644
--- a/libavcodec/x86/videodsp_init.c
+++ b/libavcodec/x86/videodsp_init.c
@@ -44,7 +44,7 @@ static av_always_inline void emulated_edge_mc(uint8_t *buf, const uint8_t *src,
                                               emu_edge_core_func *core_fn)
 {
     int start_y, start_x, end_y, end_x, src_y_add = 0;
-    int linesize = linesize_arg;
+    emuedge_linesize_type linesize = linesize_arg;
 
     if(!w || !h)
         return;



More information about the ffmpeg-cvslog mailing list