Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SSZ] Decoding does not fail if the byte sequence overflows the destination type #280

Closed
mratsim opened this issue Jun 11, 2019 · 1 comment

Comments

@mratsim
Copy link
Contributor

mratsim commented Jun 11, 2019

Test case:

import
  serialization,
  ../beacon_chain/ssz,
  byteutils

let outOfRange = "0xd5a1"
let bytes = outOfRange.hexToSeqByte()

let value = SSZ.decode(bytes, uint8)
echo value

Output is 213, we should have a ValueError, RangeError or OverflowError.

tersec pushed a commit that referenced this issue Jun 17, 2019
* Generics over tests (status-im/nim-serialization#4, status-im/nim-serialization#5, nim-lang/Nim#11225)

* Skeleton of SSZ uint tests

* Check all primitive uint types

* Add deserialization test. "wrong length" skipped due to #280

* Move test types to their specific test files

* Stint also sometimes throws an AssertionError for invalid ranges

* Add debug path for Access denied issue in Appveyor 64-bit (https://ci.appveyor.com/project/nimbus/nim-beacon-chain/builds/25278666/job/fs8q0bcluvj2gdor#L866)

* indent the Appveyor debug info
@mratsim
Copy link
Contributor Author

mratsim commented Nov 5, 2019

closing in favor of #518

@mratsim mratsim closed this as completed Nov 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant