[sysprof] libsysprof-ui: check for valid frame type before incrementing



commit aca1a6a76549e8963df925282da65b4ab17d8aba
Author: Christian Hergert <chergert redhat com>
Date:   Thu Feb 13 14:31:22 2020 -0800

    libsysprof-ui: check for valid frame type before incrementing

 src/libsysprof-ui/sysprof-display.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/libsysprof-ui/sysprof-display.c b/src/libsysprof-ui/sysprof-display.c
index 7bd8f89..9c100e9 100644
--- a/src/libsysprof-ui/sysprof-display.c
+++ b/src/libsysprof-ui/sysprof-display.c
@@ -725,7 +725,8 @@ sysprof_display_scan_worker (GTask        *task,
 
   while (sysprof_capture_reader_peek_frame (reader, &frame))
     {
-      st.frame_count[frame.type]++;
+      if (frame.type < G_N_ELEMENTS (st.frame_count))
+        st.frame_count[frame.type]++;
 
       if (frame.type == SYSPROF_CAPTURE_FRAME_METADATA)
         {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]