avm2: `setTextFormat` is range-checked
This commit is contained in:
parent
78c519cce0
commit
f188306f4f
|
@ -827,10 +827,18 @@ pub fn set_text_format<'gc>(
|
||||||
begin_index = 0;
|
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 {
|
if end_index < 0 {
|
||||||
end_index = this.text_length() as i32;
|
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(
|
this.set_text_format(
|
||||||
begin_index as usize,
|
begin_index as usize,
|
||||||
end_index as usize,
|
end_index as usize,
|
||||||
|
|
Loading…
Reference in New Issue