Skip to content
Snippets Groups Projects
Commit 67e1d527 authored by Ramiro Polla's avatar Ramiro Polla
Browse files

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
parent 65dd2ded
No related branches found
No related tags found
No related merge requests found
...@@ -106,8 +106,10 @@ static int doTest(uint8_t *ref[4], int refStride[4], int w, int h, ...@@ -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 * prefer, as long as they're aligned enough for the architecture, and
* they're freed appropriately (such as using av_free for buffers * they're freed appropriately (such as using av_free for buffers
* allocated with av_malloc). */ * allocated with av_malloc). */
src[i]= av_mallocz(srcStride[i]*srcH); /* An extra 16 bytes is being allocated because some scalers may write
dst[i]= av_mallocz(dstStride[i]*dstH); * 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); out[i]= av_mallocz(refStride[i]*h);
if (!src[i] || !dst[i] || !out[i]) { if (!src[i] || !dst[i] || !out[i]) {
perror("Malloc"); perror("Malloc");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment