librasn / rasn

A Safe #[no_std] ASN.1 Codec Framework
Other
183 stars 43 forks source link

`index_map` and `character_map` are broken (one static map is initialized for all types, and thus doesn't work for different types) #229

Closed Trolldemorted closed 4 months ago

Trolldemorted commented 4 months ago

As discussed in https://github.com/ferrilab/bitvec/issues/229#issuecomment-1984344301, the current index_map and character_map functions are broken:

https://github.com/librasn/rasn/blob/fb6e682d67caa8f3f751c66bf8067b8efc8c299f/src/types/strings/constrained.rs#L99-L112

The static MAP: OnceBox<BTreeMap<u32, u32>> exists once for all implementing types, not separately for each implementing type.