Fix crashes when some external APIs fail
I'm a PhD student. I analyzed the darktable source code and found some potential API bugs that may cause crashes.
These crashes are mainly caused by insufficient error handling of API functions like g_dir_open, curl_easy_perform or pthread_create.
I think it's unsafe to assume the library function would be correct. It would be better if we could handle the error properly.
Attached please find the patch against version darktable-2.4.1. Hopefully, it can solve these potential bugs.
Fix #12040: Add some error handling
Thank you Zhouyang Jia for finding these and proposing the patch.
#1 Updated by Tobias Ellinghaus 11 months ago
In general I agree, more error handling won't hurt.
About your changes, the result of g_dir_open in film.c is already checked later, and glib functions have their own error handling and don't use errno. The change to rawspeed needs to be proposed upstream, we are just bundling that lib. I'll manually merge the changes. Thank you.
#2 Updated by Tobias Ellinghaus 11 months ago
- % Done changed from 0 to 100
- Status changed from New to Fixed
Applied in changeset darktable|052649e9e7a708c84ca85cc68115ec7e0e30e58a.