aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/vf_unsharp.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2010-10-08 23:36:35 +0000
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2010-10-08 23:36:35 +0000
commit74d127b537d18cc9a2bf2b556900705f7b2af2be (patch)
tree98b42c9c1db9c6f0dd2f69c066024f214cb239a2 /libavfilter/vf_unsharp.c
parentfd0368e7ca35e2feaf7960564e61a76655c4d1f6 (diff)
downloadffmpeg-74d127b537d18cc9a2bf2b556900705f7b2af2be.tar.gz
Add validity checks for the unsharp filter.
Prevent crash. Originally committed as revision 25419 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavfilter/vf_unsharp.c')
-rw-r--r--libavfilter/vf_unsharp.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c
index fa6227589f..e7bf95333d 100644
--- a/libavfilter/vf_unsharp.c
+++ b/libavfilter/vf_unsharp.c
@@ -133,6 +133,13 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
sscanf(args, "%d:%d:%lf:%d:%d:%lf", &lmsize_x, &lmsize_y, &lamount,
&cmsize_x, &cmsize_y, &camount);
+ if (lmsize_x < 2 || lmsize_y < 2 || cmsize_x < 2 || cmsize_y < 2) {
+ av_log(ctx, AV_LOG_ERROR,
+ "Invalid value <2 for lmsize_x:%d or lmsize_y:%d or cmsize_x:%d or cmsize_y:%d\n",
+ lmsize_x, lmsize_y, cmsize_x, cmsize_y);
+ return AVERROR(EINVAL);
+ }
+
set_filter_param(&unsharp->luma, lmsize_x, lmsize_y, lamount);
set_filter_param(&unsharp->chroma, cmsize_x, cmsize_y, camount);