iOS App crashes when calling g_tls_file_database_new
Hi!
I want to update the GStreamer version of my iOS App from 1.16.3 to 1.18.6.
What I did:
I downloaded the installer from here: https://gstreamer.freedesktop.org/data/pkg/ios/1.18.6/gstreamer-1.0-devel-1.18.6-ios-universal.pkg I updated the gst_ios_init.h file to use openssl instead of gnutls, by replacing the #define GST_IOS_GIO_MODULE_GNUTLS
line with #define GST_IOS_GIO_MODULE_OPENSSL
The App is now crashing (iOS 15.4.1) when calling the g_tls_file_database_new (ca_certificates, NULL)
on the gst_ios_init.m
file. I am getting a EXC_BAD_ACCESS
exception, which is weird because I didn't change the certificate location.
This is a snippet of the code where the App is crashing, it only crashes if there is a file where ca_certificates
points to. If there isn't then the gst_ios_init
call runs properly, but then I cannot use encryption, which I really need to!!
const gchar *resources_dir = [resources UTF8String];
const gchar *tmp_dir = [tmp UTF8String];
const gchar *cache_dir = [cache UTF8String];
const gchar *docs_dir = [docs UTF8String];
const gchar *library_dir = [libraryString UTF8String];
gchar *ca_certificates;
g_setenv ("TMP", tmp_dir, TRUE);
g_setenv ("TEMP", tmp_dir, TRUE);
g_setenv ("TMPDIR", tmp_dir, TRUE);
g_setenv ("XDG_RUNTIME_DIR", resources_dir, TRUE);
g_setenv ("XDG_CACHE_HOME", cache_dir, TRUE);
g_setenv ("HOME", docs_dir, TRUE);
g_setenv ("XDG_DATA_DIRS", resources_dir, TRUE);
g_setenv ("XDG_CONFIG_DIRS", resources_dir, TRUE);
g_setenv ("XDG_CONFIG_HOME", cache_dir, TRUE);
g_setenv ("XDG_DATA_HOME", resources_dir, TRUE);
g_setenv ("FONTCONFIG_PATH", resources_dir, TRUE);
ca_certificates = g_build_filename (library_dir, "ca.pem", NULL);
g_setenv ("CA_CERTIFICATES", ca_certificates, TRUE);
#if defined(GST_IOS_GIO_MODULE_OPENSSL)
GST_G_IO_MODULE_LOAD(openssl);
#endif
if (ca_certificates) {
GTlsBackend *backend = g_tls_backend_get_default ();
if (backend) {
GTlsDatabase *db = g_tls_file_database_new (ca_certificates, NULL);
if (db)
g_tls_backend_set_default_database (backend, db);
}
}
g_free (ca_certificates);
gst_init (NULL, NULL);
Here's also an screenshot of the crash.
Thank you!