Skip to content

Commit ee7bb7c

Browse files
committed
chore: Use saturating_mul when calculating the output size
1 parent 8f482bd commit ee7bb7c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

css-inline/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ impl<'a> CSSInliner<'a> {
209209
#[inline]
210210
pub fn inline(&self, html: &str) -> Result<String> {
211211
// Allocating more memory than the input HTML, as the inlined version is usually bigger
212-
let mut out = Vec::with_capacity(html.len() * 2);
212+
let mut out = Vec::with_capacity(html.len().saturating_mul(2));
213213
self.inline_to(html, &mut out)?;
214214
Ok(String::from_utf8_lossy(&out).to_string())
215215
}

0 commit comments

Comments
 (0)