mirror of
https://github.com/vacp2p/nim-libp2p-experimental.git
synced 2025-01-12 19:34:23 +00:00
2373ee0061
Currently, `ecnist`'s `toBytes` and `getBytes` methods operate only on properly initialized keys. If an un-initialized key is given, an `IndexError` may be raised if the key's `xlen` / `qlen` property is larger than the maximum buffer size. This patch hardens those functions to report a proper error in that case. Note that the library functions called by `init` and `initRaw` already reject data that does not have the expected length, so these new checks should not be reachable in practice.