Skip to content
Snippets Groups Projects
Commit f81c101b authored by pompolic's avatar pompolic
Browse files

Don't allow initialization with address of 0x0

parent 26a2fa61
No related branches found
No related tags found
Loading
...@@ -4,6 +4,8 @@ class HParseResult: ...@@ -4,6 +4,8 @@ class HParseResult:
def __init__(self, address): def __init__(self, address):
# Note to self: Address has to be an integer and not string # Note to self: Address has to be an integer and not string
# Otherwise all hell breaks loose # Otherwise all hell breaks loose
if address == 0:
raise ValueError("Nullpointer given as address of HParseResult")
self.address = address self.address = address
# Mostly for convenience # Mostly for convenience
self.has_ast = self.read_AST_not_null() self.has_ast = self.read_AST_not_null()
...@@ -71,6 +73,8 @@ class HParsedToken: ...@@ -71,6 +73,8 @@ class HParsedToken:
# The former will allocate an char[] and cast it to a HParsedToken* when reading members # The former will allocate an char[] and cast it to a HParsedToken* when reading members
if isinstance(address, str): if isinstance(address, str):
print("Warning: Address % given to HParsedToken is a string. This is probably an error (expecting int or gdb.Value)" % address) print("Warning: Address % given to HParsedToken is a string. This is probably an error (expecting int or gdb.Value)" % address)
if address == 0:
raise ValueError("Nullpointer given as address of HParsedToken")
self.address = address self.address = address
# Unused for now # Unused for now
self.parent = parent self.parent = parent
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment