summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Miller <brandon@vector35.com>2024-04-17 13:55:59 -0400
committerBrandon Miller <bkmiller89@icloud.com>2024-04-25 10:56:18 -0400
commit37f394946c75a6e0e4114a27db2f6ea8d03b143c (patch)
treef2f00c202475145a0f89b803f216926e9214c962
parent2aa2be5c713a76c86118a225c5cae6ef3585412d (diff)
Moved TryReadPointer to core BinaryReader class
-rw-r--r--binaryninjacore.h3
-rw-r--r--binaryreader.cpp9
2 files changed, 3 insertions, 9 deletions
diff --git a/binaryninjacore.h b/binaryninjacore.h
index 08353373..d0f7a5e2 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -44,7 +44,7 @@
// will require rebuilding. The minimum version is increased when there are
// incompatible changes that break binary compatibility, such as changes to
// existing types or functions.
-#define BN_MINIMUM_CORE_ABI_VERSION 59
+#define BN_MINIMUM_CORE_ABI_VERSION 60
#ifdef __GNUC__
#ifdef BINARYNINJACORE_LIBRARY
@@ -3918,6 +3918,7 @@ extern "C"
BINARYNINJACOREAPI bool BNReadBE16(BNBinaryReader* stream, uint16_t* result);
BINARYNINJACOREAPI bool BNReadBE32(BNBinaryReader* stream, uint32_t* result);
BINARYNINJACOREAPI bool BNReadBE64(BNBinaryReader* stream, uint64_t* result);
+ BINARYNINJACOREAPI bool BNReadPointer(BNBinaryView* view, BNBinaryReader* stream, uint64_t* result);
BINARYNINJACOREAPI uint64_t BNGetReaderPosition(BNBinaryReader* stream);
BINARYNINJACOREAPI void BNSeekBinaryReader(BNBinaryReader* stream, uint64_t offset);
diff --git a/binaryreader.cpp b/binaryreader.cpp
index c49637f9..4b698310 100644
--- a/binaryreader.cpp
+++ b/binaryreader.cpp
@@ -314,14 +314,7 @@ bool BinaryReader::TryRead64(uint64_t& result)
bool BinaryReader::TryReadPointer(uint64_t& result)
{
- size_t addressSize = m_view->GetAddressSize();
- if (addressSize > 8 || addressSize == 0)
- return false;
-
- if (GetEndianness() == BigEndian)
- return TryReadBEPointer(result);
-
- return TryReadLEPointer(result);
+ return BNReadPointer(m_view->GetObject(), m_stream, &result);
}