Helge Deller 47d1e98231 util/interval-tree: Check root for null in interval_tree_iter_first
Fix a crash in qemu-user when running

    cat /proc/self/maps

in a chroot, where /proc isn't mounted.

The problem was introduced by commit 3ce3dd8ca965 ("util/selfmap:
Rewrite using qemu/interval-tree.h") where in open_self_maps_1() the
function read_self_maps() is called and which returns NULL if it can't
read the hosts /proc/self/maps file. Afterwards that NULL is fed into
interval_tree_iter_first() which doesn't check if the root node is NULL.

Fix it by adding a check if root is NULL and return NULL in that case.

Signed-off-by: Helge Deller <deller@gmx.de>
Fixes: 3ce3dd8ca965 ("util/selfmap: Rewrite using qemu/interval-tree.h")
Message-Id: <ZNOsq6Z7t/eyIG/9@p100>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2023-08-09 09:26:32 -07:00
..
2023-05-30 17:37:26 +02:00
2023-03-20 12:43:50 +01:00
2023-05-23 15:20:15 +08:00
2023-03-20 12:43:50 +01:00
2023-06-13 17:42:01 +10:00
2023-07-08 07:30:17 +01:00
2023-04-24 11:29:00 +02:00
2023-03-13 15:23:37 +04:00
2023-03-28 15:23:10 -07:00
2023-05-08 11:10:49 +02:00
2023-04-27 16:39:43 +02:00