1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

lavfi/gradfun: reduce up limit for threshold.

This will prevent an overflow in the SSSE3 and MMX filter_line code:
delta is expressed as an u16 being shifted by 2 to the left. If it
overflows, having a strength not above 64 will make sure that m is set
to 0 (making the m*m*delta >> 14 expression void).

A value above 64 should not make any sense unless gradfun is used as a
blur filter.
This commit is contained in:
Clément Bœsch 2012-12-18 21:44:51 +01:00
parent 63e1fc2588
commit 3bdd70fc66
3 changed files with 3 additions and 3 deletions

View File

@ -2670,7 +2670,7 @@ The filter takes two optional parameters, separated by ':':
@var{strength} is the maximum amount by which the filter will change @var{strength} is the maximum amount by which the filter will change
any one pixel. Also the threshold for detecting nearly flat any one pixel. Also the threshold for detecting nearly flat
regions. Acceptable values range from .51 to 255, default value is regions. Acceptable values range from .51 to 64, default value is
1.2, out-of-range values will be clipped to the valid range. 1.2, out-of-range values will be clipped to the valid range.
@var{radius} is the neighborhood to fit the gradient to. A larger @var{radius} is the neighborhood to fit the gradient to. A larger

View File

@ -30,7 +30,7 @@
#define LIBAVFILTER_VERSION_MAJOR 3 #define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR 28 #define LIBAVFILTER_VERSION_MINOR 28
#define LIBAVFILTER_VERSION_MICRO 100 #define LIBAVFILTER_VERSION_MICRO 101
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \ LIBAVFILTER_VERSION_MINOR, \

View File

@ -128,7 +128,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
if (args) if (args)
sscanf(args, "%f:%d", &thresh, &radius); sscanf(args, "%f:%d", &thresh, &radius);
thresh = av_clipf(thresh, 0.51, 255); thresh = av_clipf(thresh, 0.51, 64);
gf->thresh = (1 << 15) / thresh; gf->thresh = (1 << 15) / thresh;
gf->radius = av_clip((radius + 1) & ~1, 4, 32); gf->radius = av_clip((radius + 1) & ~1, 4, 32);