[sysprof/gbsneto/fix-rpi4-crash] details-page: Protect against NULL line
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof/gbsneto/fix-rpi4-crash] details-page: Protect against NULL line
- Date: Mon, 30 Dec 2019 17:05:16 +0000 (UTC)
commit a67701848dfe0f5ceeaadcc47df99a0663a1e0b9
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Dec 30 14:03:15 2019 -0300
details-page: Protect against NULL line
On a Raspberry PI 4, Sysprof crashes immediately when
trying to memchr() on the 'line' variable. The current
RPI4 support is poor on Linux mainline admitedly, but
having Sysprof to work on it at least gives us a chance
to profile the major bottlenecks.
Protect against NULL 'line'.
src/libsysprof-ui/sysprof-details-page.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/libsysprof-ui/sysprof-details-page.c b/src/libsysprof-ui/sysprof-details-page.c
index 03963c5..daee548 100644
--- a/src/libsysprof-ui/sysprof-details-page.c
+++ b/src/libsysprof-ui/sysprof-details-page.c
@@ -142,8 +142,12 @@ cpu_info_cb (const SysprofCaptureFrame *frame,
const gchar *line;
gchar **str = user_data;
- endptr = (gchar *)fc->data + fc->len;
line = memmem ((gchar *)fc->data, fc->len, "model name", 10);
+
+ if (!line)
+ return FALSE;
+
+ endptr = (gchar *)fc->data + fc->len;
endptr = memchr (line, '\n', endptr - line);
if (endptr)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]