swf: Fix incorrect parsing of clip actions in SWFv5
Clip action flags in SWFv5 are only 2 bytes big.
This commit is contained in:
parent
0506b7c566
commit
3fddb659fb
|
@ -2174,7 +2174,9 @@ impl<R: Read> Reader<R> {
|
|||
event_list.insert(ClipEvent::Load);
|
||||
}
|
||||
if self.version < 6 {
|
||||
self.read_u16()?;
|
||||
// SWF19 pp. 48-50: For SWFv5, the ClipEventFlags only had 2 bytes of flags,
|
||||
// with the 2nd byte reserved (all 0).
|
||||
// This was expanded to 4 bytes in SWFv6.
|
||||
self.read_u8()?;
|
||||
} else {
|
||||
if self.read_bit()? {
|
||||
|
|
|
@ -1902,6 +1902,36 @@ pub fn tag_tests() -> Vec<TagTestData> {
|
|||
})),
|
||||
read_tag_bytes_from_file("tests/swfs/DefineShape.swf", TagCode::PlaceObject2),
|
||||
),
|
||||
(
|
||||
5, // Specifically test for SWFv5 ClipActions.
|
||||
Tag::PlaceObject(Box::new(PlaceObject {
|
||||
version: 2,
|
||||
action: PlaceObjectAction::Place(2),
|
||||
depth: 1,
|
||||
matrix: Some(Matrix::new()),
|
||||
color_transform: None,
|
||||
ratio: None,
|
||||
name: None,
|
||||
clip_depth: None,
|
||||
class_name: None,
|
||||
filters: vec![],
|
||||
background_color: None,
|
||||
blend_mode: BlendMode::Normal,
|
||||
clip_actions: vec![ClipAction {
|
||||
events: vec![ClipEvent::EnterFrame].into_iter().collect(),
|
||||
key_code: None,
|
||||
action_data: vec![150, 6, 0, 0, 99, 108, 105, 112, 0, 38, 0],
|
||||
}],
|
||||
is_image: false,
|
||||
is_bitmap_cached: false,
|
||||
is_visible: true,
|
||||
amf_data: None,
|
||||
})),
|
||||
read_tag_bytes_from_file(
|
||||
"tests/swfs/PlaceObject2-ClipActionsV5-CS6.swf",
|
||||
TagCode::PlaceObject2,
|
||||
),
|
||||
),
|
||||
(
|
||||
6, // ClipActions added in SWF version 5-6.
|
||||
Tag::PlaceObject(Box::new(PlaceObject {
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue