Skip to content

Commit

Permalink
Moved TryReadPointer to core BinaryReader class
Browse files Browse the repository at this point in the history
  • Loading branch information
zznop committed Apr 25, 2024
1 parent 2aa2be5 commit 37f3949
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
3 changes: 2 additions & 1 deletion binaryninjacore.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
9 changes: 1 addition & 8 deletions binaryreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down

0 comments on commit 37f3949

Please sign in to comment.