summaryrefslogtreecommitdiff
path: root/libswscale
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-12-07 21:48:27 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-12-07 21:50:07 +0100
commit320ae9fb784f898331d21de225178a1fca0a7849 (patch)
treed0c26d8e3aad02e0d8a1ba509fd2be484717c92d /libswscale
parent710c4baf528c9598bfe97313872d368e2006841e (diff)
sws_scale: check input against NULL
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale')
-rw-r--r--libswscale/swscale.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 632e85a44f..a4229604b3 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -789,10 +789,17 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
const int dstStride[])
{
int i, ret;
- const uint8_t *src2[4] = { srcSlice[0], srcSlice[1], srcSlice[2], srcSlice[3] };
- uint8_t *dst2[4] = { dst[0], dst[1], dst[2], dst[3] };
+ const uint8_t *src2[4];
+ uint8_t *dst2[4];
uint8_t *rgb0_tmp = NULL;
+ if (!srcSlice || !dstStride || !dst || !srcSlice) {
+ av_log(c, AV_LOG_ERROR, "One of the input parameters to sws_scale() is NULL, please check the calling code\n");
+ return 0;
+ }
+ memcpy(src2, srcSlice, sizeof(src2));
+ memcpy(dst2, dst, sizeof(dst2));
+
// do not mess up sliceDir if we have a "trailing" 0-size slice
if (srcSliceH == 0)
return 0;