Commit 321e85e1 authored by Michael Niedermayer's avatar Michael Niedermayer

swscale/swscale: Add some sanity checks for srcSlice* parameters

Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 033b49e0
...@@ -1048,12 +1048,20 @@ int attribute_align_arg sws_scale(struct SwsContext *c, ...@@ -1048,12 +1048,20 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
const uint8_t *src2[4]; const uint8_t *src2[4];
uint8_t *dst2[4]; uint8_t *dst2[4];
uint8_t *rgb0_tmp = NULL; uint8_t *rgb0_tmp = NULL;
int macro_height = isBayer(c->srcFormat) ? 2 : (1 << c->chrSrcVSubSample);
if (!srcStride || !dstStride || !dst || !srcSlice) { 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"); av_log(c, AV_LOG_ERROR, "One of the input parameters to sws_scale() is NULL, please check the calling code\n");
return 0; 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]) { if (c->gamma_flag && c->cascaded_context[0]) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment