Commit 71d9ae11 authored by Paul B Mahol's avatar Paul B Mahol

avfilter/vf_signalstats: fix stack buffer overflow

Fixes #8249
parent 0e68e8c9
...@@ -491,7 +491,7 @@ static int compute_sat_hue_metrics8(AVFilterContext *ctx, void *arg, int jobnr, ...@@ -491,7 +491,7 @@ static int compute_sat_hue_metrics8(AVFilterContext *ctx, void *arg, int jobnr,
const int yuvu = p_u[i]; const int yuvu = p_u[i];
const int yuvv = p_v[i]; const int yuvv = p_v[i];
p_sat[i] = hypot(yuvu - 128, yuvv - 128); // int or round? p_sat[i] = hypot(yuvu - 128, yuvv - 128); // int or round?
((int16_t*)p_hue)[i] = floor((180 / M_PI) * atan2f(yuvu-128, yuvv-128) + 180); ((int16_t*)p_hue)[i] = fmod(floor((180 / M_PI) * atan2f(yuvu-128, yuvv-128) + 180), 360.);
} }
p_u += lsz_u; p_u += lsz_u;
p_v += lsz_v; p_v += lsz_v;
...@@ -530,7 +530,7 @@ static int compute_sat_hue_metrics16(AVFilterContext *ctx, void *arg, int jobnr, ...@@ -530,7 +530,7 @@ static int compute_sat_hue_metrics16(AVFilterContext *ctx, void *arg, int jobnr,
const int yuvu = p_u[i]; const int yuvu = p_u[i];
const int yuvv = p_v[i]; const int yuvv = p_v[i];
p_sat[i] = hypot(yuvu - mid, yuvv - mid); // int or round? p_sat[i] = hypot(yuvu - mid, yuvv - mid); // int or round?
((int16_t*)p_hue)[i] = floor((180 / M_PI) * atan2f(yuvu-mid, yuvv-mid) + 180); ((int16_t*)p_hue)[i] = fmod(floor((180 / M_PI) * atan2f(yuvu-mid, yuvv-mid) + 180), 360.);
} }
p_u += lsz_u; p_u += lsz_u;
p_v += lsz_v; p_v += lsz_v;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment