ethereum / solidity-examples

Loose collection of Solidity example code
MIT License
534 stars 161 forks source link

Bytes.concat copy to wrong dest2 #50

Closed skyinfall closed 4 years ago

skyinfall commented 5 years ago

in Line 86: (function concat) var dest2 = dest + src2Len; should be: var dest2 = dest + srcLen;

you can test by concat 0x1234 and 0x1234567890abcdef1234567890abcdef

chriseth commented 5 years ago

My bad! I was looking at the wrong repository.

androlo commented 4 years ago

I see what the problem is. There is an assertion missing in the test at https://github.com/ethereum/solidity-examples/blob/master/test/bytes/bytes.sol#L275, and another one a few lines down. It does the equals check but there is no assertion there. That's why this was not detected.

androlo commented 4 years ago

(i see that there has already been a pr, nice)