aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-01-17 18:57:01 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2016-01-31 00:23:45 +0100
commit1b6390dd5be9f4edae0230c18c462d91d185ff16 (patch)
tree10abfc53889a17895ef6818c6f4baff84d984126
parentedc7ef376bbea64441d3756dcb7301c646dead20 (diff)
downloadffmpeg-1b6390dd5be9f4edae0230c18c462d91d185ff16.tar.gz
swscale/swscale: Add some sanity checks for srcSlice* parameters
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 321e85e1769ca1fc1567025ae264760790ee7fc9) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libswscale/swscale.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 5312016927..c3a14b7009 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -919,12 +919,20 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
const uint8_t *src2[4];
uint8_t *dst2[4];
uint8_t *rgb0_tmp = NULL;
+ int macro_height = isBayer(c->srcFormat) ? 2 : (1 << c->chrSrcVSubSample);
if (!srcStride || !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;
}
+ if ((srcSliceY & (macro_height-1)) ||
+ ((srcSliceH& (macro_height-1)) && srcSliceY + srcSliceH != c->srcH) ||
+ srcSliceY + srcSliceH > c->srcH) {
+ av_log(c, AV_LOG_ERROR, "Slice parameters %d, %d are invalid\n", srcSliceY, srcSliceH);
+ return AVERROR(EINVAL);
+ }
+
if (c->gamma_flag && c->cascaded_context[0]) {