graphviz: check whether dlpi_name is NULL

At least on an Android O device I have, one of the dl_phdr_info
objects passed to the callback of dl_iterate_phdr has NULL in its
dlpi_name field.
This commit is contained in:
Tom Yan 2022-08-10 01:02:15 +08:00 committed by tomty89
parent cb5c48f81d
commit 99f6fe4deb
1 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,16 @@
diff --git a/lib/gvc/gvconfig.c b/lib/gvc/gvconfig.c
index 2d86321..ecb011b 100644
--- a/lib/gvc/gvconfig.c
+++ b/lib/gvc/gvconfig.c
@@ -268,6 +268,11 @@ static void gvconfig_write_library_config(GVC_t *gvc, char *lib_path,
static int line_callback(struct dl_phdr_info *info, size_t size, void *line)
{
const char *p = info->dlpi_name;
+
+ /* At least on an Android O device I have, this can happen */
+ if (!p)
+ return 0;
+
char *tmp = strstr(p, "/libgvc.");
(void) size;
if (tmp) {