[vlc-devel] [PATCH 1/4] lib: media_player: release old media earlier
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Fri Sep 18 10:01:26 CEST 2020
On Fri, Sep 18, 2020, at 9:42 AM, Thomas Guillem wrote:
> md or mp->p_md is not used after. No rick of race since mp->p_md is
Risk*
> always written with the player lock held.
>
> This fixes a potential null-dereference if the media was already set to
> null and release by the user via libvlc_media_player_set_media().
Given than libvlc_media_release is checking for NULL media, I don't understand the potential null-deref
> ---
> lib/media_player.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/lib/media_player.c b/lib/media_player.c
> index 4db7f96af05..26cf6469589 100644
> --- a/lib/media_player.c
> +++ b/lib/media_player.c
> @@ -72,7 +72,10 @@ on_current_media_changed(vlc_player_t *player,
> input_item_t *new_media,
> return;
>
> if (md)
> + {
> media_detach_preparsed_event(md);
> + libvlc_media_release(md);
> + }
>
> if (new_media)
> {
> @@ -87,8 +90,6 @@ on_current_media_changed(vlc_player_t *player,
> input_item_t *new_media,
> else
> mp->p_md = NULL;
>
> - libvlc_media_release(md);
> -
> libvlc_event_t event;
> event.type = libvlc_MediaPlayerMediaChanged;
> event.u.media_player_media_changed.new_media = mp->p_md;
> --
> 2.28.0
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
--
Hugo Beauzée-Luyssen
hugo at beauzee.fr
More information about the vlc-devel
mailing list