ethereumjs-abi
ethereumjs-abi copied to clipboard
rawEncode silently accepts invalid hex strings
Actual
$ node
> require('ethereumjs-abi').rawEncode(["uint256"], "g")
<Buffer 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10>
The string "g"
gets interpreted as "f"+1
.
Expected
Calling rawEncode
with invalid number or hex string should throw.
Maybe check value in this function: encodeSingle
?