mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
NewValueFromBytes panics on some bad input
This commit is contained in:
parent
8cf9ed0ea5
commit
06da07a584
1 changed files with 14 additions and 0 deletions
|
|
@ -68,3 +68,17 @@ func (s *ValueSuite) TestString(c *checker.C) {
|
||||||
exp := int64(10)
|
exp := int64(10)
|
||||||
c.Assert(NewValue(data).Int(), checker.DeepEquals, exp)
|
c.Assert(NewValue(data).Int(), checker.DeepEquals, exp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *ValueSuite) TestAdversary(c *checker.C) {
|
||||||
|
badRlp := []string{
|
||||||
|
"10fa5",
|
||||||
|
"10fa56a89200b3c",
|
||||||
|
"f971808813c16d60fa56a89200b3c8f3421aaa3626c711a1bed1c",
|
||||||
|
"f971808813c16d67555ec800881bc16d674ec8000094bbbd0256041f7aed3ce278c56ee61492de96d0018401312d008061a06162636465666768696a6b6c6d6e6f707172737475767778797a616263646566a06162636465666768696a6b6c6d6e6f707172737475767778797a6162636465",
|
||||||
|
"f971808813c16d67555ec800881bc16d674ec8110094bbbd3256041f7aed3ce278c59ee62492de06d001832401312d008061a06162636465666768696a6b6c6d6e6f7071727475ab767778797a616263646566a06162636465666768696a6b6c6d6e6f7071",
|
||||||
|
}
|
||||||
|
// simply looking for input that panics
|
||||||
|
for _, v := range badRlp {
|
||||||
|
NewValueFromBytes(Hex2Bytes(v))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue