From 4e07d8c4bd8cfbd3e56b7a233483c8efe5b84300 Mon Sep 17 00:00:00 2001 From: Jordan Wiens Date: Wed, 12 Dec 2018 22:35:37 -0500 Subject: better error handling for bv.read --- python/binaryview.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'python') diff --git a/python/binaryview.py b/python/binaryview.py index 6ecca2dc..612632d3 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -1939,6 +1939,8 @@ class BinaryView(object): >>> bv.read(0,4) \'\\xcf\\xfa\\xed\\xfe\' """ + if (addr < 0) or (length < 0): + raise ValueError("length and address must both be positive") buf = databuffer.DataBuffer(handle=core.BNReadViewBuffer(self.handle, addr, length)) return bytes(buf) -- cgit v1.3.1