avm2: `setTextFormat` is range-checked

This commit is contained in:
David Wendt 2021-03-03 21:11:42 -05:00 committed by Mike Welsh
parent 78c519cce0
commit f188306f4f
1 changed files with 8 additions and 0 deletions

View File

@ -827,10 +827,18 @@ pub fn set_text_format<'gc>(
begin_index = 0;
}
if begin_index as usize > this.text_length() {
return Err("RangeError: The supplied index is out of bounds.".into());
}
if end_index < 0 {
end_index = this.text_length() as i32;
}
if end_index as usize > this.text_length() {
return Err("RangeError: The supplied index is out of bounds.".into());
}
this.set_text_format(
begin_index as usize,
end_index as usize,