From fbb852198e8c15508a9c624f1bf2c42c79681a64 Mon Sep 17 00:00:00 2001 From: Serge Lamikhov-Center Date: Mon, 20 Sep 2021 00:26:23 +0300 Subject: [PATCH] Use standard defined value for max ULL --- elfio/elfio_section.hpp | 7 ++++--- elfio/elfio_segment.hpp | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/elfio/elfio_section.hpp b/elfio/elfio_section.hpp index 2532902..6eed58b 100644 --- a/elfio/elfio_section.hpp +++ b/elfio/elfio_section.hpp @@ -26,6 +26,7 @@ THE SOFTWARE. #include #include #include +#include namespace ELFIO { @@ -198,10 +199,10 @@ template class section_impl : public section set_stream_size( stream.tellg() ); } else { - set_stream_size( 0xFFFFFFFFFFFFFFFF ); + set_stream_size( ULLONG_MAX ); } - stream.seekg( ( *translator )[ header_offset ] ); + stream.seekg( ( *translator )[header_offset] ); stream.read( reinterpret_cast( &header ), sizeof( header ) ); Elf_Xword size = get_size(); @@ -211,7 +212,7 @@ template class section_impl : public section if ( ( 0 != size ) && ( nullptr != data ) ) { stream.seekg( - ( *translator )[ ( *convertor )( header.sh_offset ) ] ); + ( *translator )[( *convertor )( header.sh_offset )] ); stream.read( data, size ); data[size] = 0; // Ensure data is ended with 0 to avoid oob read data_size = size; diff --git a/elfio/elfio_segment.hpp b/elfio/elfio_segment.hpp index e2cf251..aff4030 100644 --- a/elfio/elfio_segment.hpp +++ b/elfio/elfio_segment.hpp @@ -26,6 +26,7 @@ THE SOFTWARE. #include #include #include +#include namespace ELFIO { @@ -173,7 +174,7 @@ template class segment_impl : public segment set_stream_size( stream.tellg() ); } else { - set_stream_size( 0xFFFFFFFFFFFFFFFF ); + set_stream_size( ULLONG_MAX ); } stream.seekg( ( *translator )[header_offset] );