ystero-dev / hampi

Rust ASN.1 Toolkit
Other
44 stars 17 forks source link

Fixed integer underflow panic when self.bytes.len() == 0 #83

Closed nathaniel-bennett closed 1 year ago

nathaniel-bennett commented 1 year ago

This is functionally the same as before:

((len - 1) / 8) + 1 = ((len - 1) / 8) + 8/8 = ((len - 1) + 8) / 8 = (len + 7) / 8

It just ensures that the function will not panic if the length of the data happens to be 0.