From fb8e5044b420d4f7409a3bf2cc5498e8302882be Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 24 Feb 2015 00:35:11 +0100 Subject: [PATCH] swscale/utils: add asserts to check filterpos Signed-off-by: Michael Niedermayer --- libswscale/utils.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libswscale/utils.c b/libswscale/utils.c index b63ab190a6..cfa6b21794 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -631,6 +631,13 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos, (*filterPos)[i]-= shift; filter[i * filterSize + srcW - 1 - (*filterPos)[i]] += acc; } + av_assert0((*filterPos)[i] >= 0); + av_assert0((*filterPos)[i] < srcW); + if ((*filterPos)[i] + filterSize > srcW) { + for (j = 0; j < filterSize; j++) { + av_assert0((*filterPos)[i] + j < srcW || !filter[i * filterSize + j]); + } + } } // Note the +1 is for the MMX scaler which reads over the end