summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRamiro Polla <ramiro.polla@gmail.com>2010-07-22 15:30:22 +0000
committerRamiro Polla <ramiro.polla@gmail.com>2010-07-22 15:30:22 +0000
commit67e1d52783f506c00d7a12eff3fdb2eb268b8dbd (patch)
tree9991d6ae0b7de29b143cdfe0ec49058c67e61b8c
parent65dd2ded3ffe26602e180c40b31c325ad0adba28 (diff)
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. Originally committed as revision 31768 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
-rw-r--r--libswscale/swscale-test.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libswscale/swscale-test.c b/libswscale/swscale-test.c
index d19f521f9f..4dec6d38af 100644
--- a/libswscale/swscale-test.c
+++ b/libswscale/swscale-test.c
@@ -106,8 +106,10 @@ static int doTest(uint8_t *ref[4], int refStride[4], int w, int h,
* 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");