Skip to content

Commit

Permalink
#1702 add more checks
Browse files Browse the repository at this point in the history
  • Loading branch information
olehnikolaiev committed Nov 13, 2023
1 parent ca16ebf commit 4995613
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libethereum/Precompiled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ static void convertBytesToString(
throw std::runtime_error( "Input is too short - invalid input in convertBytesToString()" );
}
bigint const sstringLength( parseBigEndianRightPadded( _in, _startPosition, UINT256_SIZE ) );
if ( sstringLength < 0 ) {
throw std::runtime_error(
"Negative string length - invalid input in convertBytesToString()" );
}
_stringLength = sstringLength.convert_to< size_t >();
if ( _startPosition + UINT256_SIZE + _stringLength > _in.size() ) {
throw std::runtime_error( "Invalid input in convertBytesToString()" );
Expand Down

0 comments on commit 4995613

Please sign in to comment.