Using SetDialogHandlers later results in a segmentation fault on Android x86/x64 only
Summary
Using SetDialogHandlers to override "Question" for the case of overriding the dialog for insecure HTTPS connections results in a segmentation fault.
Minimal project and steps to reproduce
- Open "LibVLCSharp.Android.Sample" in the Samples directory.
- Add the call to SetDialogHandlers in the code. The example below should be good enough to repro the problem.
....
_libVLC = new LibVLC(enableDebugLogs: true);
_libVLC.SetDialogHandlers((title, text) => Task.CompletedTask,
(dialog, title, text, username, store, token) => Task.CompletedTask,
(dialog, title, text, type, canceltext, firstactiontext, secondactiontext, token) => Task.CompletedTask,
(dialog, title, text, indeterminate, position, canceltext, token) => Task.CompletedTask,
(dialog, position, text) => Task.CompletedTask);
_mediaPlayer = new MediaPlayer(_libVLC)
{
EnableHardwareDecoding = true
};
....
- Change the URL to point to a "https" site that has a certificate that is not signed by a trusted CA. You don't have to have it actually serve up any media file because it never gets that far. This example should work without having to stand up a web server:
using var media = new Media(_libVLC, new Uri("https://self-signed.badssl.com/"));
What is the current bug behavior?
Segmentation fault occurs
What is the expected correct behavior?
No crash. If I put a breakpoint on the lambda I'd expect to hit that. I can't override the function to accept the dialog because it crashes.
Does it work on other plaforms? Does it work with the official VLC apps?
I have only tested on Android. This is likely only applicable to libvlcsharp. The official VLC app works fine.
Relevant logs and/or screenshots
11-15 06:33:02.629 D/VLC (19867): [d39e3030/4d9b] libvlc input: Creating an input for '(null)'
11-15 06:33:02.632 D/VLC (19867): [d39e3030/4db1] libvlc input: using timeshift granularity of 50 MiB
11-15 06:33:02.632 D/VLC (19867): [d39e3030/4db1] libvlc input: using default timeshift path
11-15 06:33:02.632 D/VLC (19867): [d39e3030/4db1] libvlc input: `https://self-signed.badssl.com/' gives access `https' demux `any' path `self-signed.badssl.com/'
11-15 06:33:02.632 D/VLC (19867): [e80e2830/4db1] libvlc input source: creating demux: access='https' demux='any' location='self-signed.badssl.com/' file='(null)'
11-15 06:33:02.632 D/VLC (19867): [e80e28d0/4db1] libvlc demux: looking for access_demux module matching "https": 6 candidates
11-15 06:33:02.633 D/VLC (19867): [e80e28d0/4db1] libvlc demux: no access_demux modules matched
11-15 06:33:02.633 D/VLC (19867): [e80e2970/4db1] libvlc stream: creating access: https://self-signed.badssl.com/
11-15 06:33:02.634 D/VLC (19867): [e80e2970/4db1] libvlc stream: looking for access module matching "https": 24 candidates
11-15 06:33:02.634 D/VLC (19867): [d3890eb0/4db1] libvlc tls client: looking for tls client module matching "any": 1 candidates
11-15 06:33:02.634 D/VLC (19867): [d3890eb0/4db1] libvlc tls client: using GnuTLS version 3.5.19
11-15 06:33:02.638 D/Mono (19867): DllImport searching in: 'libvlc' ('libvlc.so').
11-15 06:33:02.638 D/Mono (19867): Searching for 'libvlc_media_release'.
11-15 06:33:02.638 D/Mono (19867): Probing 'libvlc_media_release'.
11-15 06:33:02.639 D/Mono (19867): Found as 'libvlc_media_release'.
11-15 06:33:02.666 D/VLC (19867): [d3890eb0/4db1] libvlc tls client: loaded 137 trusted CAs from system
11-15 06:33:02.666 D/VLC (19867): [d3890eb0/4db1] libvlc tls client: using tls client module "gnutls"
11-15 06:33:02.667 D/VLC (19867): [d3890eb0/4db1] libvlc tls client: resolving self-signed.badssl.com ...
11-15 06:33:02.738 D/HostConnection(19867): HostConnection::get() New Host Connection established 0xe9aa1370, tid 19890
11-15 06:33:02.745 D/HostConnection(19867): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1 ANDROID_EMU_async_unmap_buffer GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_2
11-15 06:33:02.755 I/ConfigStore(19867): android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
11-15 06:33:02.756 I/ConfigStore(19867): android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
11-15 06:33:02.757 I/OpenGLRenderer(19867): Initialized EGL, version 1.4
11-15 06:33:02.757 D/OpenGLRenderer(19867): Swap behavior 1
11-15 06:33:02.765 D/eglCodecCommon(19867): setVertexArrayObject: set vao to 0 (0) 0 0
11-15 06:33:02.765 D/EGL_emulation(19867): eglCreateContext: 0xe9a854e0: maj 2 min 0 rcv 2
11-15 06:33:02.767 D/EGL_emulation(19867): eglMakeCurrent: 0xe9a854e0: ver 2 0 (tinfo 0xe9a83c30)
11-15 06:33:02.803 D/HostConnection(19867): createUnique: call
11-15 06:33:02.804 D/HostConnection(19867): HostConnection::get() New Host Connection established 0xe9aa15f0, tid 19890
11-15 06:33:02.808 D/HostConnection(19867): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1 ANDROID_EMU_async_unmap_buffer GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_2
11-15 06:33:02.808 E/eglCodecCommon(19867): GoldfishAddressSpaceHostMemoryAllocator: ioctl_ping failed for device_type=5, ret=-1
11-15 06:33:02.816 D/EGL_emulation(19867): eglMakeCurrent: 0xe9a854e0: ver 2 0 (tinfo 0xe9a83c30)
11-15 06:33:02.828 D/VLC (19867): [d3890eb0/4db1] libvlc tls client: TLS handshake: Resource temporarily unavailable, try again.
11-15 06:33:02.878 D/VLC (19867): [d3890eb0/4db1] libvlc tls client: TLS handshake: Success.
=================================================================
Native Crash Reporting
=================================================================
Got a SEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
No native Android stacktrace (see debuggerd output).
=================================================================
Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0xf0e4833c):
11-15 06:33:02.878 D/VLC (19867): [d3890eb0/4db1] libvlc tls client: - safe renegotiation (RFC5746) enabled
11-15 06:33:02.878 D/VLC (19867): [d3890eb0/4db1] libvlc tls client: - false start (RFC7918) enabled
0xf0e4832c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0xf0e4833c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0xf0e4834c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0xf0e4835c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................11-15 06:33:02.878 E/VLC (19867): [d3890eb0/4db1] libvlc tls client: Certificate verification failure: The certificate is NOT trusted. The certificate issuer is unknown.
11-15 06:33:02.879 D/VLC (19867): [d3890eb0/4db1] libvlc tls client: 1 certificate(s) in the list
11-15 06:33:02.879 D/VLC (19867): [d3890eb0/4db1] libvlc tls client: no known certificates for self-signed.badssl.com
11-15 06:33:02.886 F/libc (19867): Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xf0e4833c in tid 19889 (config_GetGener), pid 19867 (ompanyname.app2)
Environment
- OS: Android
- Version Pie 9.0
- Device: Android TV (Emulator in Visual Studio)
- LibVLC version and architecture LibVLC.Android 3.2.0
- LibVLCSharp version 3.4.9
Possible fixes
Unknown