GNSPS / solidity-bytes-utils

Utility Solidity library composed of basic operations for tightly packed bytes arrays
The Unlicense
514 stars 109 forks source link

Fix zero-length slice taint bug #43

Closed GNSPS closed 3 years ago

GNSPS commented 3 years ago

Fix a bug where, in the case the memory was tainted before calling the slice method with a desired length of 0, the returned bytes array, instead of being a zero-length slice was an array of arbitrary length based on the values that previously populated that memory region.

Overall, the usage of zero-length slices should be pretty unusual and so, hopefully this bug does not have far-reaching implications. Nonetheless, please update the library to the new version ASAP if you're using it in production.