vlc/lib
Alexandre Janniaux f6d17cd8e4 lib: media_player: keep player libvlc instance
The media_player instance retains and releases the libvlc instance it's
created from. When using a different libvlc instance for media_player
and media, it was using the libvlc instance from the media_t object,
leading to the release of the wrong libvlc instance, and thus potential
use-after-free of one instance and leaks of the other.

It has been spotted since VLCKit creates a shared libvlc instance and
then can create a new libvlc instance in case the VLCMediaPlayer is
created with different options, which means that the VLCMediaPlayer and
the VLCMedia will be bound to different libvlc instances, triggering the
issue described in first paragraph and crashing.

/!\ This commit changes libvlc behaviour in the following case:

 - There's at least two libvlc instance, one being the parent of a media
   and the other being the parent of a media_player.

 - The media is set on the media_player.

 - A new media is played by the underlying vlc_player_t, in which case
   the new libvlc_media_t instance is now created with the player
   libvlc instance instead of the media libvlc instance.

 - The user call libvlc_media_player_get_media() on the player.

 - The user call preparse functions on the media.

Since this very case was leading to crash anyway, and is quite
intricate, it's probably not a very important change though.

Refs videolan/VLCKit#189, videolan/VLCKit#116

Cherry-picked from commit 12fa8556c0.
2020-11-23 17:41:19 +01:00
..
Makefile.am messages: resolve module name at link-time 2017-11-18 21:41:26 +02:00
audio.c lib: fix libvlc_audio_output_device_list_get() crash 2018-02-28 21:07:40 +02:00
core.c messages: resolve module name at link-time 2017-11-18 21:41:26 +02:00
dialog.c libvlc: re-order dialog callback arguments 2016-03-10 11:45:27 +01:00
error.c libvlc: fix potentially leaked error message 2014-02-27 20:33:31 +02:00
event.c vlc_arrays: split array_append in checked and w/abort 2017-10-25 12:33:02 +02:00
libvlc.pc.in Move src/control/ to lib/ 2011-08-30 23:40:34 +03:00
libvlc.sym lib: hide libvlc_media_player_set_evas_object 2018-02-02 14:48:32 +01:00
libvlc_internal.h lib: event: remove new/release functions 2017-05-15 21:33:39 +03:00
log.c libvlc: clean up deprecated functions 2016-04-25 10:46:04 +02:00
media.c lib: send media_list end event after 2020-11-10 11:35:31 +01:00
media_discoverer.c lib/media_discoverer: libvlc_media_discoverer_release: simplify 2017-05-18 19:05:59 +03:00
media_internal.h lib: media: allocate event manager in-place 2017-05-15 21:33:39 +03:00
media_library.c xspf: fix opening media library 2017-06-04 10:45:36 +03:00
media_list.c vlc_arrays: split array_insert in checked and w/abort 2017-10-25 12:33:02 +02:00
media_list_internal.h lib: media_list: allocate event manager in-place 2017-05-15 21:33:39 +03:00
media_list_path.h lib/media_list_path: remove trailing whitespace 2016-10-13 11:09:29 +02:00
media_list_player.c libvlc: media_list_player: Fix invalid subitem detection 2018-03-19 15:08:11 +01:00
media_player.c lib: media_player: keep player libvlc instance 2020-11-23 17:41:19 +01:00
media_player_internal.h lib: fix libvlc_media_player_set_renderer 2017-12-01 15:11:29 +01:00
playlist.c libvlc: clean up deprecated functions 2016-04-25 10:46:04 +02:00
renderer_discoverer.c lib: renderer_discoverer: Allow a renderer_discoverer to be stopped then released 2018-03-21 16:53:23 +01:00
renderer_discoverer_internal.h lib: fix libvlc_media_player_set_renderer 2017-12-01 15:11:29 +01:00
video.c input: Reintroduce subtitle extension check 2017-10-04 11:06:52 +02:00
vlm.c lib: vlm: pass a non-NULL pointer as event object 2017-05-15 21:33:39 +03:00