Marwes / combine

A parser combinator library for Rust
https://docs.rs/combine/*/combine/
MIT License
1.29k stars 93 forks source link

Fix a couple instances of potential UB #316

Closed anp closed 3 years ago

anp commented 3 years ago

2 changes:

  1. update poll_extend_buf to actually preinitialize the bytes as suggested by comment
  2. add an assertion to prevent ever reading uninit bytes out of a slice if other arithmetic errors occur
  3. add // SAFETY: ... comments to a number of unsafe blocks
anp commented 3 years ago

Thanks for #317, that's much cleaner. I've rebased on top of it since it cleans up my change significantly.