gst_ios_init.m implementation contains error
Hi,
I had the issue that our iOS App started crashing when playing files via https.
The code/pipeline was working but then suddenly the error occured. Most likely it's caused by the update to iOS 14.2, but I wasn't able to find out why.
As we're using the binary distribution of GStreamer and the whole application stack is rather complex I wasn't able to find out more from the stacktrace than that the crash happend in "_get_portable_X509_cert_file" (called from souphttpsrc).
As I digged into the problem I found out that the way gst_ios_init.m is implemented is wrong and thus most likely on iOS no certificate database is configured at all.
g_tls_file_database_new
needs an existing file to be passed as "anchors", it does not create the file itself. In addition it has to contain at least one certificate in PEM encoded format.
My guess is that from iOS 14.2 on some related internals changed that now lead to the crash when no certificate database was set up for GTls.
I shipped around the problem by writing a random certificate to the file given to g_tls_file_database_new
as "anchors", this is ok as we work with self signed certificates and don't do validation. On other setups a proper certificate store has to be used.
I'm opening this issue as it was quite hard to find the cause of the problem. Perhaps it's worth adding a comment to the implementation as a reference or even improve the code a bit, i.e. add an check if the file exists or so.