aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-12-23 21:14:59 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2017-01-26 00:34:12 +0100
commit07df85b9586f0fd303b08266126e5d1f8c797b9a (patch)
treea2aa00a15399f6ca3011a4c3d138ecab5516c881
parent7643e8584f3a3711963889d79decf780e4d9390c (diff)
downloadffmpeg-07df85b9586f0fd303b08266126e5d1f8c797b9a.tar.gz
swscale/swscale: Fix dereference of stride array before null check
Fixes: CID1396263 Fixes: CID1396271 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 03ce71e4a1187340720e1569ac96c285c145a1f7) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libswscale/swscale.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index c3a8d0efd4..32214346b2 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -762,10 +762,8 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
uint8_t *rgb0_tmp = NULL;
int macro_height = isBayer(c->srcFormat) ? 2 : (1 << c->chrSrcVSubSample);
// copy strides, so they can safely be modified
- int srcStride2[4] = { srcStride[0], srcStride[1], srcStride[2],
- srcStride[3] };
- int dstStride2[4] = { dstStride[0], dstStride[1], dstStride[2],
- dstStride[3] };
+ int srcStride2[4];
+ int dstStride2[4];
int srcSliceY_internal = srcSliceY;
if (!srcStride || !dstStride || !dst || !srcSlice) {
@@ -773,6 +771,11 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
return 0;
}
+ for (i=0; i<4; i++) {
+ srcStride2[i] = srcStride[i];
+ dstStride2[i] = dstStride[i];
+ }
+
if ((srcSliceY & (macro_height-1)) ||
((srcSliceH& (macro_height-1)) && srcSliceY + srcSliceH != c->srcH) ||
srcSliceY + srcSliceH > c->srcH) {