Commit: 2ac944a1bf22a4315d87c738f35767aa74ce4fe4
Parent: 33aa27332f09c024c8cfd312ff7e75e2c2a7a8a3
Author: Randy Palamar
Date: Mon, 9 Dec 2024 07:18:06 -0700
gdb: clamp s8 len to prevent python overflows
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.config/gdb/plugins.py b/.config/gdb/plugins.py
@@ -7,8 +7,8 @@ class s8_printer(gdb.ValuePrinter):
def to_string(self):
len = self.val["len"]
- str = self.val["data"].string(length=len)
- return '{data = "%s", len = %s}' % (str, len)
+ str = self.val["data"].string(length=min(max(len, 0), 64))
+ return '{len = %d, data = "%s"}' % (len, str)
def build_pretty_printer():