mirror of
https://codeberg.org/demostf/parser.git
synced 2026-11-30 02:30:46 +01:00
harden against dos with crafted input by limiting reserved vec/map size
This commit is contained in:
parent
42c0eb2c89
commit
3caadadb3b
7 changed files with 14 additions and 7 deletions
|
|
@ -9,6 +9,7 @@ use parse_display::{Display, FromStr};
|
|||
use serde::{Deserialize, Serialize};
|
||||
use std::borrow::Borrow;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::cmp::min;
|
||||
use std::fmt;
|
||||
use std::num::ParseIntError;
|
||||
use std::ops::Deref;
|
||||
|
|
@ -83,7 +84,7 @@ impl ParseSendTable {
|
|||
let prop_count = stream.read_int(10)?;
|
||||
|
||||
let mut array_element_prop = None;
|
||||
let mut props = Vec::with_capacity(prop_count);
|
||||
let mut props = Vec::with_capacity(min(prop_count, 128));
|
||||
|
||||
for prop_index in 0..prop_count {
|
||||
let definition_index = SendPropDefinitionIndex::new(table_index, prop_index);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue