[FFmpeg-devel] avfilter/af_amix: fix possible hang

Submitted by Paul B Mahol on June 18, 2017, 4:39 p.m.

Details

Message ID 20170618163933.31389-1-onemda@gmail.com
State Superseded
Headers show

Commit Message

Paul B Mahol June 18, 2017, 4:39 p.m.
Fixes #6424.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavfilter/af_amix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nicolas George June 18, 2017, 5:01 p.m.
Thanks for trying to fix it.

Le decadi 30 prairial, an CCXXV, Paul B Mahol a écrit :
> Fixes #6424.
> 
> Signed-off-by: Paul B Mahol <onemda@gmail.com>
> ---
>  libavfilter/af_amix.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c
> index 9fe505b..e06c753 100644
> --- a/libavfilter/af_amix.c
> +++ b/libavfilter/af_amix.c
> @@ -288,7 +288,7 @@ static int output_frame(AVFilterLink *outlink)
>                  if (ns < nb_samples) {
>                      if (!(s->input_state[i] & INPUT_EOF))
>                          /* unclosed input with not enough samples */
> -                        return 0;
> +                        return ff_request_frame(ctx->inputs[i]);
>                      /* closed input to drain */
>                      nb_samples = ns;
>                  }

There is a call filter_frame() -> output_frame(); filter_frame() must
never call ff_request_frame().

If you are absolutely sure that this branch can only be entered when
coming from request_frame() or request_samples(), please include a proof
of it in the commit message or as a comment.

If you are not absolutely sure, then it may be invalid.

Regards,

Patch hide | download patch | download mbox

diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c
index 9fe505b..e06c753 100644
--- a/libavfilter/af_amix.c
+++ b/libavfilter/af_amix.c
@@ -288,7 +288,7 @@  static int output_frame(AVFilterLink *outlink)
                 if (ns < nb_samples) {
                     if (!(s->input_state[i] & INPUT_EOF))
                         /* unclosed input with not enough samples */
-                        return 0;
+                        return ff_request_frame(ctx->inputs[i]);
                     /* closed input to drain */
                     nb_samples = ns;
                 }