From 1bb5a361c8cfab7b39692dec42e57514712503b1 Mon Sep 17 00:00:00 2001 From: Zerotistic <54184933+Zerotistic@users.noreply.github.com> Date: Sat, 26 Oct 2024 23:48:22 +0200 Subject: fix: validate input type in TypeLibrary.add_alternate_name to prevent crashes Fixes Vector35/binaryninja-api#5814. The function now checks if the input is of type . This prevents crashes caused by passing null or non-string values. --- python/typelibrary.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'python') diff --git a/python/typelibrary.py b/python/typelibrary.py index 724f8c5e..232cd6a0 100644 --- a/python/typelibrary.py +++ b/python/typelibrary.py @@ -183,6 +183,8 @@ class TypeLibrary: def add_alternate_name(self, name: str) -> None: """Adds an extra name to this type library used during library lookups and dependency resolution""" + if type(name) != str: + raise ValueError(f"Expected name to be str, got {type(name)}") core.BNAddTypeLibraryAlternateName(self.handle, name) @property -- cgit v1.3.1