[x264-devel] commit: Error out on invalid input stride (Jason Garrett-Glaser )

git at videolan.org git at videolan.org
Thu May 6 07:49:21 CEST 2010


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Sat May  1 19:32:01 2010 -0700| [ccc03ec16125e0586231afbb06936bd0bf8c926d] | committer: Jason Garrett-Glaser 

Error out on invalid input stride
Might catch some crashes due to buggy calling applications.

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

 common/frame.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/common/frame.c b/common/frame.c
index fa8eec0..66ebee8 100644
--- a/common/frame.c
+++ b/common/frame.c
@@ -219,7 +219,7 @@ int x264_frame_copy_picture( x264_t *h, x264_frame_t *dst, x264_picture_t *src )
     int i_csp = src->img.i_csp & X264_CSP_MASK;
     if( i_csp != X264_CSP_I420 && i_csp != X264_CSP_YV12 )
     {
-        x264_log( h, X264_LOG_ERROR, "Arg invalid CSP\n" );
+        x264_log( h, X264_LOG_ERROR, "Invalid input colorspace\n" );
         return -1;
     }
 
@@ -241,6 +241,11 @@ int x264_frame_copy_picture( x264_t *h, x264_frame_t *dst, x264_picture_t *src )
             plane += (height-1)*stride;
             stride = -stride;
         }
+        if( width > abs(stride) )
+        {
+            x264_log( h, X264_LOG_ERROR, "Input picture width is greater than stride\n" );
+            return -1;
+        }
         h->mc.plane_copy( dst->plane[i], dst->i_stride[i], plane, stride, width, height );
     }
     return 0;



More information about the x264-devel mailing list