[FFmpeg-cvslog] sws: Check for malloc failure of rgb0_tmp
Michael Niedermayer
git at videolan.org
Sun Apr 28 19:39:36 CEST 2013
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Apr 28 19:31:16 2013 +0200| [24ec7a5e049e8cad6269e5efe46bee87f61dff3f] | committer: Michael Niedermayer
sws: Check for malloc failure of rgb0_tmp
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=24ec7a5e049e8cad6269e5efe46bee87f61dff3f
---
libswscale/swscale.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 190a7b9..1581072 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -968,6 +968,9 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
uint8_t *base;
int x,y;
rgb0_tmp = av_malloc(FFABS(srcStride[0]) * srcSliceH + 32);
+ if (!rgb0_tmp)
+ return AVERROR(ENOMEM);
+
base = srcStride[0] < 0 ? rgb0_tmp - srcStride[0] * (srcSliceH-1) : rgb0_tmp;
for (y=0; y<srcSliceH; y++){
memcpy(base + srcStride[0]*y, src2[0] + srcStride[0]*y, 4*c->srcW);
@@ -981,6 +984,9 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
if (c->srcXYZ && !(c->dstXYZ && c->srcW==c->dstW && c->srcH==c->dstH)) {
uint8_t *base;
rgb0_tmp = av_malloc(FFABS(srcStride[0]) * srcSliceH + 32);
+ if (!rgb0_tmp)
+ return AVERROR(ENOMEM);
+
base = srcStride[0] < 0 ? rgb0_tmp - srcStride[0] * (srcSliceH-1) : rgb0_tmp;
xyz12Torgb48(c, base, src2[0], srcStride[0]/2, srcSliceH);
More information about the ffmpeg-cvslog
mailing list