This commit is contained in:
Chris Fallin 2022-11-29 10:38:31 -08:00
parent 6373cfd665
commit a053396e69
No known key found for this signature in database
GPG key ID: 31649E4FE65EB465

View file

@ -233,7 +233,13 @@ fn handle_payload<'a>(
} }
let table_items = module.table_mut(table).func_elements.as_mut().unwrap(); let table_items = module.table_mut(table).func_elements.as_mut().unwrap();
let new_size = offset + funcs.len(); let new_size = offset.checked_add(funcs.len()).ok_or_else(|| {
FrontendError::TooLarge(format!(
"Overflowing element offset + length: {} + {}",
offset,
funcs.len()
))
})?;
if new_size > table_items.len() { if new_size > table_items.len() {
static MAX_TABLE: usize = 100_000; static MAX_TABLE: usize = 100_000;
if new_size > MAX_TABLE { if new_size > MAX_TABLE {