mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof: avoid UB on bsearch
This commit is contained in:
@ -224,11 +224,14 @@ sysprof_address_layout_lookup (SysprofAddressLayout *self,
|
||||
g_list_model_items_changed (G_LIST_MODEL (self), 0, old_len, self->mmaps->len);
|
||||
}
|
||||
|
||||
ret = bsearch (&address,
|
||||
self->mmaps->pdata,
|
||||
self->mmaps->len,
|
||||
sizeof (gpointer),
|
||||
find_by_address);
|
||||
if (self->mmaps->len > 0)
|
||||
ret = bsearch (&address,
|
||||
self->mmaps->pdata,
|
||||
self->mmaps->len,
|
||||
sizeof (gpointer),
|
||||
find_by_address);
|
||||
else
|
||||
ret = NULL;
|
||||
|
||||
return ret ? *ret : NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user