mirror of
https://github.com/serge1/ELFIO.git
synced 2024-12-26 18:15:40 +00:00
check that stream is big enough, accounting for overflow
This commit is contained in:
parent
3bc66a0e50
commit
92b9b67df6
@ -285,7 +285,7 @@ template <class T> class section_impl : public section
|
||||
Elf_Xword size = get_size();
|
||||
if ( nullptr == data && SHT_NULL != get_type() &&
|
||||
SHT_NOBITS != get_type() &&
|
||||
( sh_offset + size ) <= get_stream_size() ) {
|
||||
sh_offset <= get_stream_size() && size <= (get_stream_size() - sh_offset)) {
|
||||
data.reset( new ( std::nothrow ) char[size_t( size ) + 1] );
|
||||
|
||||
if ( ( 0 != size ) && ( nullptr != data ) ) {
|
||||
|
Loading…
Reference in New Issue
Block a user