Skip to content

Commit 37f3949

Browse files
committed
Moved TryReadPointer to core BinaryReader class
1 parent 2aa2be5 commit 37f3949

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

binaryninjacore.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
// will require rebuilding. The minimum version is increased when there are
4545
// incompatible changes that break binary compatibility, such as changes to
4646
// existing types or functions.
47-
#define BN_MINIMUM_CORE_ABI_VERSION 59
47+
#define BN_MINIMUM_CORE_ABI_VERSION 60
4848

4949
#ifdef __GNUC__
5050
#ifdef BINARYNINJACORE_LIBRARY
@@ -3918,6 +3918,7 @@ extern "C"
39183918
BINARYNINJACOREAPI bool BNReadBE16(BNBinaryReader* stream, uint16_t* result);
39193919
BINARYNINJACOREAPI bool BNReadBE32(BNBinaryReader* stream, uint32_t* result);
39203920
BINARYNINJACOREAPI bool BNReadBE64(BNBinaryReader* stream, uint64_t* result);
3921+
BINARYNINJACOREAPI bool BNReadPointer(BNBinaryView* view, BNBinaryReader* stream, uint64_t* result);
39213922

39223923
BINARYNINJACOREAPI uint64_t BNGetReaderPosition(BNBinaryReader* stream);
39233924
BINARYNINJACOREAPI void BNSeekBinaryReader(BNBinaryReader* stream, uint64_t offset);

binaryreader.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -314,14 +314,7 @@ bool BinaryReader::TryRead64(uint64_t& result)
314314

315315
bool BinaryReader::TryReadPointer(uint64_t& result)
316316
{
317-
size_t addressSize = m_view->GetAddressSize();
318-
if (addressSize > 8 || addressSize == 0)
319-
return false;
320-
321-
if (GetEndianness() == BigEndian)
322-
return TryReadBEPointer(result);
323-
324-
return TryReadLEPointer(result);
317+
return BNReadPointer(m_view->GetObject(), m_stream, &result);
325318
}
326319

327320

0 commit comments

Comments
 (0)