swf: Allow StyleChangeRecord in DefineShape v1

The spec says that StyleChangeRecord is only supported in
DefineShape2+, but SWFs exist with StyleChangeRecord in
DefineShape1 tags, and these play correctly in the Flash Player.
(see #929 HAGIMURA_EXTREME.swf).
This commit is contained in:
Mike Welsh 2020-07-24 18:17:35 -07:00
parent 07122dc931
commit 4680b01f03
1 changed files with 4 additions and 1 deletions

View File

@ -2023,7 +2023,10 @@ impl<R: Read> Reader<R> {
if (flags & 0b1000) != 0 { if (flags & 0b1000) != 0 {
new_style.line_style = Some(self.read_ubits(num_line_bits)?); new_style.line_style = Some(self.read_ubits(num_line_bits)?);
} }
if shape_version >= 2 && (flags & 0b10000) != 0 { // The spec says that StyleChangeRecord can only occur in DefineShape2+,
// but SWFs in the wild exist with them in DefineShape1 (generated by third party tools),
// and these run correctly in the Flash Player.
if (flags & 0b10000) != 0 {
let new_styles = self.read_shape_styles(shape_version)?; let new_styles = self.read_shape_styles(shape_version)?;
new_style.new_styles = Some(new_styles); new_style.new_styles = Some(new_styles);
} }