mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avfilter/vf_palettegen: add protection against potential divide by zero
In libavfilter/vf_palettegen.c, the function get_avg_color requires that box->len greater than zero to avoid dividing by zero. However, the call sequence filter_frame -> get_palette_frame -> get_avg_color may not satisfy this precondition. Fixes #9222. Signed-off-by: Yiyuan GUO <yguoaz@gmail.com>
This commit is contained in:
parent
910a24eb33
commit
2201c91fbf
@ -528,7 +528,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||
if (s->stats_mode == STATS_MODE_DIFF_FRAMES) {
|
||||
av_frame_free(&s->prev_frame);
|
||||
s->prev_frame = in;
|
||||
} else if (s->stats_mode == STATS_MODE_SINGLE_FRAMES) {
|
||||
} else if (s->stats_mode == STATS_MODE_SINGLE_FRAMES && s->nb_refs > 0) {
|
||||
AVFrame *out;
|
||||
int i;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user