[FFmpeg-devel] [PATCH] lavfi/deshake: fix deshake crash issue.
Jun Zhao
mypopydev at gmail.com
Tue Sep 18 16:37:29 EEST 2018
Fixes ticket #7441.
Signed-off-by: Jun Zhao <mypopydev at gmail.com>
---
libavfilter/vf_deshake.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c
index 55ce5e1..5d2c7fa 100644
--- a/libavfilter/vf_deshake.c
+++ b/libavfilter/vf_deshake.c
@@ -196,11 +196,13 @@ static int block_contrast(uint8_t *src, int x, int y, int stride, int blocksize)
for (i = 0; i <= blocksize * 2; i++) {
// We use a width of 16 here to match the sad function
for (j = 0; j <= 15; j++) {
- pos = (y - i) * stride + (x - j);
- if (src[pos] < lowest)
- lowest = src[pos];
- else if (src[pos] > highest) {
- highest = src[pos];
+ if (y >= i) {
+ pos = (y - i) * stride + (x - j);
+ if (src[pos] < lowest)
+ lowest = src[pos];
+ else if (src[pos] > highest) {
+ highest = src[pos];
+ }
}
}
}
--
1.7.1
More information about the ffmpeg-devel
mailing list