summaryrefslogtreecommitdiff
path: root/libavfilter/vf_deshake.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-04-15 14:28:19 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-04-15 14:28:19 +0200
commit3d8afb23bc9a9e333c9348db89b766b00fcff52c (patch)
tree5b19f4e4b7985d9a46d1a6d67cfe152b03a9cb33 /libavfilter/vf_deshake.c
parent1557f34b10e6095a5cbf13ac5fcd3c095e2a93af (diff)
vf_deshake: Fix crash with r*=64
Replace literal numbers by named R_MAX and correct their value Fixes half of Ticket2443 Based on patch by: João Bernardo <jbvsmo@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/vf_deshake.c')
-rw-r--r--libavfilter/vf_deshake.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c
index d5f80b0e9f..01ef721f53 100644
--- a/libavfilter/vf_deshake.c
+++ b/libavfilter/vf_deshake.c
@@ -68,13 +68,15 @@
#define OFFSET(x) offsetof(DeshakeContext, x)
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
+#define MAX_R 64
+
static const AVOption deshake_options[] = {
{ "x", "set x for the rectangular search area", OFFSET(cx), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, .flags = FLAGS },
{ "y", "set y for the rectangular search area", OFFSET(cy), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, .flags = FLAGS },
{ "w", "set width for the rectangular search area", OFFSET(cw), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, .flags = FLAGS },
{ "h", "set height for the rectangular search area", OFFSET(ch), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, .flags = FLAGS },
- { "rx", "set x for the rectangular search area", OFFSET(rx), AV_OPT_TYPE_INT, {.i64=16}, 0, 64, .flags = FLAGS },
- { "ry", "set y for the rectangular search area", OFFSET(ry), AV_OPT_TYPE_INT, {.i64=16}, 0, 64, .flags = FLAGS },
+ { "rx", "set x for the rectangular search area", OFFSET(rx), AV_OPT_TYPE_INT, {.i64=16}, 0, MAX_R, .flags = FLAGS },
+ { "ry", "set y for the rectangular search area", OFFSET(ry), AV_OPT_TYPE_INT, {.i64=16}, 0, MAX_R, .flags = FLAGS },
{ "edge", "set edge mode", OFFSET(edge), AV_OPT_TYPE_INT, {.i64=FILL_MIRROR}, FILL_BLANK, FILL_COUNT-1, FLAGS, "edge"},
{ "blank", "fill zeroes at blank locations", 0, AV_OPT_TYPE_CONST, {.i64=FILL_BLANK}, INT_MIN, INT_MAX, FLAGS, "edge" },
{ "original", "original image at blank locations", 0, AV_OPT_TYPE_CONST, {.i64=FILL_ORIGINAL}, INT_MIN, INT_MAX, FLAGS, "edge" },
@@ -242,7 +244,7 @@ static void find_motion(DeshakeContext *deshake, uint8_t *src1, uint8_t *src2,
{
int x, y;
IntMotionVector mv = {0, 0};
- int counts[128][128];
+ int counts[2*MAX_R+1][2*MAX_R+1];
int count_max_value = 0;
int contrast;