[x264-devel] commit: Fix a crash in --dump-yuv for odd resolutions (Loren Merritt )

git at videolan.org git at videolan.org
Fri Nov 19 23:50:08 CET 2010


x264 | branch: master | Loren Merritt <pengvado at akuvian.org> | Sun Nov 14 02:54:02 2010 -0800| [8c16b4d3311126bc37ae0ea7071c683e280f388c] | committer: Jason Garrett-Glaser 

Fix a crash in --dump-yuv for odd resolutions

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

 common/mc.h       |    1 +
 encoder/encoder.c |    7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/common/mc.h b/common/mc.h
index 680c5dd..a04b5c5 100644
--- a/common/mc.h
+++ b/common/mc.h
@@ -92,6 +92,7 @@ typedef struct
     void (*plane_copy_interleave)( pixel *dst, int i_dst,
                                    uint8_t *srcu, int i_srcu,
                                    uint8_t *srcv, int i_srcv, int w, int h );
+    /* may write up to 15 pixels off the end of each plane */
     void (*plane_copy_deinterleave)( pixel *dstu, int i_dstu,
                                      pixel *dstv, int i_dstv,
                                      pixel *src, int i_src, int w, int h );
diff --git a/encoder/encoder.c b/encoder/encoder.c
index 2a6b0df..ede1c28 100644
--- a/encoder/encoder.c
+++ b/encoder/encoder.c
@@ -77,10 +77,11 @@ static void x264_frame_dump( x264_t *h )
         fwrite( &h->fdec->plane[0][y*h->fdec->i_stride[0]], sizeof(pixel), h->param.i_width, f );
     int cw = h->param.i_width>>1;
     int ch = h->param.i_height>>1;
-    pixel *planeu = x264_malloc( cw*ch*2*sizeof(pixel) );
-    pixel *planev = planeu + cw*ch;
+    pixel *planeu = x264_malloc( (cw*ch*2+32)*sizeof(pixel) );
+    pixel *planev = planeu + cw*ch + 16;
     h->mc.plane_copy_deinterleave( planeu, cw, planev, cw, h->fdec->plane[1], h->fdec->i_stride[1], cw, ch );
-    fwrite( planeu, 1, cw*ch*2*sizeof(pixel), f );
+    fwrite( planeu, 1, cw*ch*sizeof(pixel), f );
+    fwrite( planev, 1, cw*ch*sizeof(pixel), f );
     x264_free( planeu );
     fclose( f );
 }



More information about the x264-devel mailing list