summaryrefslogtreecommitdiff
path: root/python/binaryview.py
diff options
context:
space:
mode:
authorJordan Wiens <jordan@psifertex.com>2018-12-12 22:35:37 -0500
committerJordan Wiens <jordan@psifertex.com>2018-12-12 22:35:37 -0500
commit4e07d8c4bd8cfbd3e56b7a233483c8efe5b84300 (patch)
tree660f61df95ada22939674edb9e756cad96fe75ff /python/binaryview.py
parent01a9eb27ea90e62476bb368f1e418745777f24b5 (diff)
better error handling for bv.read
Diffstat (limited to 'python/binaryview.py')
-rw-r--r--python/binaryview.py2
1 files changed, 2 insertions, 0 deletions
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)