Skip to content

Commit

Permalink
Bug fix for improper RLP decoding.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bradez committed Mar 17, 2021
1 parent bc9e29f commit a5b7731
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/RLP.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

/**
* This file is part of rlp package.
*
*
* (c) Kuan-Cheng,Lai <[email protected]>
*
*
* @author Peter Lai <[email protected]>
* @license MIT
*/
Expand Down Expand Up @@ -102,7 +102,7 @@ protected function decodeData(string $input)
throw new RuntimeException('Invalid RLP.');
}
$length = hexdec($hexLength);
$data = mb_substr($input, $llength * 2, ($length + $llength - 1) * 2);
$data = mb_substr($input, $llength * 2, $length * 2);

if (mb_strlen($data) < $length * 2) {
throw new RuntimeException('Invalid RLP.');
Expand Down Expand Up @@ -159,7 +159,7 @@ protected function decodeData(string $input)

/**
* encodeLength
*
*
* @param int $length
* @param int $offset
* @return string
Expand All @@ -176,7 +176,7 @@ protected function encodeLength(int $length, int $offset)

/**
* intToHex
*
*
* @param int $value
* @return string
*/
Expand All @@ -189,7 +189,7 @@ protected function intToHex(int $value)

/**
* padToEven
*
*
* @param string $value
* @return string
*/
Expand Down Expand Up @@ -222,4 +222,4 @@ protected function encodeInput($input)
}
throw new InvalidArgumentException('The input type didn\'t support.');
}
}
}

0 comments on commit a5b7731

Please sign in to comment.