summaryrefslogtreecommitdiff
path: root/type.cpp
diff options
context:
space:
mode:
authorRusty Wagner <rusty.wagner@gmail.com>2023-01-24 18:38:13 -0700
committerRusty Wagner <rusty.wagner@gmail.com>2023-01-30 11:57:43 -0500
commita3939bdec15f9299ae9a681255fa93c47113870a (patch)
tree2b4bb5643ac3cd25a618a99a542968fe81c66bcc /type.cpp
parentcf4220570c2d1b7105fb29719383f64026d46837 (diff)
Fix UAF on C++ BinaryView plugin init, improve demangler and BinaryView APIs
Diffstat (limited to 'type.cpp')
-rw-r--r--type.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/type.cpp b/type.cpp
index a2e92985..1c7b425e 100644
--- a/type.cpp
+++ b/type.cpp
@@ -794,7 +794,8 @@ Ref<Type> Type::EnumerationType(Architecture* arch, Enumeration* enm, size_t wid
BNBoolWithConfidence isSignedConf;
isSignedConf.value = isSigned.GetValue();
isSignedConf.confidence = isSigned.GetConfidence();
- return new Type(BNCreateEnumerationType(arch->GetObject(), enm->GetObject(), width, &isSignedConf));
+ return new Type(
+ BNCreateEnumerationType(arch ? arch->GetObject() : nullptr, enm->GetObject(), width, &isSignedConf));
}
@@ -1629,8 +1630,8 @@ TypeBuilder TypeBuilder::EnumerationType(
BNBoolWithConfidence isSignedConf;
isSignedConf.value = isSigned.GetValue();
isSignedConf.confidence = isSigned.GetConfidence();
- return TypeBuilder(
- BNCreateEnumerationTypeBuilderWithBuilder(arch->GetObject(), enm->GetObject(), width, &isSignedConf));
+ return TypeBuilder(BNCreateEnumerationTypeBuilderWithBuilder(
+ arch ? arch->GetObject() : nullptr, enm->GetObject(), width, &isSignedConf));
}
TypeBuilder TypeBuilder::PointerType(Architecture* arch, const Confidence<Ref<Type>>& type,