css-minify
css-minify copied to clipboard
panic on invalid color value
use css_minify::optimizations::{Minifier, Level};
fn main() {
let _ = std::hint::black_box(
Minifier::default().minify("*{color:#f}", Level::Three)
);
}
thread 'main' panicked at 'byte index 4 is out of bounds of `#f`', /home/sarpnt/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/css-minify-0.3.1/src/optimizations/color.rs:27:12
issue is here, you should instead use get which doesn't panic. you might want to check other cases of indexing in your code too and ensure they don't have a chance of panicking either.