On Thu, Feb 27, 2020 at 5:03 AM jb <j...@kdenlive.org> wrote:

> Hi all,
>
>
> Following a Kdenlive's bug report, I reproducer a crash in transition_mix
> when using a "consumer" producer is inserted in a playlist, if that
> producer has a different fps than current project.
>
>
> Problem is that in consumer_producer, we have that:
>
> static int get_audio(...)
>
> (...)
>
>     // if not repeating last frame
>     if ( mlt_frame_get_position( nested_frame ) != cx->audio_position )
>     {...}
>
>     else
>     {
>         // otherwise return no samples  <-- this case seems to be
> triggered when producer fps is different
>         *samples = 0;
>         *buffer = NULL;
>     }
>
> Having a NULL audio frame buffer and 0 samples is not correctly handled in
> transition_mix, leading to a crash in line 195:
>
>     memcpy( &self->dest_buffer[self->dest_buffer_count * channels_a],
> buffer_a, bytes );
>
>
> Crash can be fixed by changing consumer_producer.c, adding this at line
> 101:
>
>     *channels = 0;
>
>
> It triggers a bypass in transisiton_mix.c, preventing the crash.
>
> Would that be ok or should this better be fixed by changing transition_mix
> ?
>

I think the fix should be in transition_mix.c. How about

--- src/modules/core/transition_mix.c
+++ src/modules/core/transition_mix.c
@@ -141,3 +141,3 @@ static int transition_get_audio( mlt_frame frame_a,
void **buffer, mlt_audio_for
  // Prevent dividing by zero.
- if ( !channels_a || !channels_b )
+ if ( !channels_a || !channels_b || !buffer_a || !buffer_b )
  return 1;
_______________________________________________
Mlt-devel mailing list
Mlt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel

Reply via email to