changeset 31702:74360873ab4d

swscale-test: allocate more memory to prevent scalers from writing out of bounds Some converters (ie. unscaled rgb24 -> argb) may write some bytes out of bounds. Ideally the converters should be fixed, but in the meantime we allocate more memory to prevent heap corruption.
author ramiro
date Thu, 22 Jul 2010 15:30:22 +0000
parents 013a496467b9
children 764c5061ab85
files libswscale/swscale-test.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libswscale/swscale-test.c	Thu Jul 22 08:52:41 2010 +0000
+++ b/libswscale/swscale-test.c	Thu Jul 22 15:30:22 2010 +0000
@@ -106,8 +106,10 @@
          * prefer, as long as they're aligned enough for the architecture, and
          * they're freed appropriately (such as using av_free for buffers
          * allocated with av_malloc). */
-        src[i]= av_mallocz(srcStride[i]*srcH);
-        dst[i]= av_mallocz(dstStride[i]*dstH);
+        /* An extra 16 bytes is being allocated because some scalers may write
+         * out of bounds. */
+        src[i]= av_mallocz(srcStride[i]*srcH+16);
+        dst[i]= av_mallocz(dstStride[i]*dstH+16);
         out[i]= av_mallocz(refStride[i]*h);
         if (!src[i] || !dst[i] || !out[i]) {
             perror("Malloc");