[sysprof] libsysprof-capture: check frame length overruns



commit fd215a39a3485fe52eb5d8a343d8f3a5b21d0174
Author: Christian Hergert <chergert redhat com>
Date:   Sun Feb 23 14:26:13 2020 -0800

    libsysprof-capture: check frame length overruns
    
    If we got a corrupted frame, just stop reading forward immediately.

 src/libsysprof-capture/sysprof-capture-reader.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/src/libsysprof-capture/sysprof-capture-reader.c b/src/libsysprof-capture/sysprof-capture-reader.c
index 29b94ca..0759b33 100644
--- a/src/libsysprof-capture/sysprof-capture-reader.c
+++ b/src/libsysprof-capture/sysprof-capture-reader.c
@@ -491,6 +491,9 @@ sysprof_capture_reader_read_basic (SysprofCaptureReader    *self,
   if (frame->type != type)
     return NULL;
 
+  if (frame->len > (self->len - self->pos))
+    return NULL;
+
   self->pos += frame->len;
 
   return frame;


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