diff options
| author | Jordan Wiens <jordan@psifertex.com> | 2018-12-12 22:35:37 -0500 |
|---|---|---|
| committer | Jordan Wiens <jordan@psifertex.com> | 2018-12-12 22:35:37 -0500 |
| commit | 4e07d8c4bd8cfbd3e56b7a233483c8efe5b84300 (patch) | |
| tree | 660f61df95ada22939674edb9e756cad96fe75ff /python | |
| parent | 01a9eb27ea90e62476bb368f1e418745777f24b5 (diff) | |
better error handling for bv.read
Diffstat (limited to 'python')
| -rw-r--r-- | python/binaryview.py | 2 |
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) |
