avfilter/bwdif: account for chroma sub-sampling in min size calculation
The current logic for detecting frames that are too small for the
algorithm does not account for chroma sub-sampling, and so a sample
where the luma plane is large enough, but the chroma planes are not
will not be rejected. In that event, a heap overflow will occur.
This change adjusts the logic to consider the chroma planes and makes
the change to all three bwdif implementations.
Fixes #10688
Signed-off-by: Cosmin Stejerean <cosmin@cosmin.at>
Reviewed-by: Thomas Mundt <tmundt75@gmail.com>
Signed-off-by: Philip Langdale <philipl@overt.org>
(cherry picked from commit 737ede405b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
dae907d551
commit
e6ef90db6c
1 changed files with 4 additions and 3 deletions
|
|
@ -505,12 +505,13 @@ static int config_props(AVFilterLink *link)
|
|||
if(s->mode&1)
|
||||
link->frame_rate = av_mul_q(link->src->inputs[0]->frame_rate, (AVRational){2,1});
|
||||
|
||||
if (link->w < 3 || link->h < 4) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Video of less than 3 columns or 4 lines is not supported\n");
|
||||
s->csp = av_pix_fmt_desc_get(link->format);
|
||||
|
||||
if (AV_CEIL_RSHIFT(link->w, s->csp->log2_chroma_w) < 3 || AV_CEIL_RSHIFT(link->h, s->csp->log2_chroma_h) < 4) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Video with planes less than 3 columns or 4 lines is not supported\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
s->csp = av_pix_fmt_desc_get(link->format);
|
||||
if (s->csp->comp[0].depth > 8) {
|
||||
s->filter_intra = filter_intra_16bit;
|
||||
s->filter_line = filter_line_c_16bit;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue