Skip to content

Commit 41cf80c

Browse files
authored
Fix bug in anchor points method (#157)
1 parent c2d3bf1 commit 41cf80c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/tables/kerx.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ pub struct AnchorPoints<'a>(&'a [u8]);
166166
impl AnchorPoints<'_> {
167167
/// Returns a mark and current anchor points at action index.
168168
pub fn get(&self, action_index: u16) -> Option<(u16, u16)> {
169-
let offset = usize::from(action_index) * u16::SIZE;
169+
// Each action contains two 16-bit fields, so we must
170+
// double the action_index to get the correct offset here.
171+
let offset = usize::from(action_index) * u16::SIZE * 2;
170172
let mut s = Stream::new_at(self.0, offset)?;
171173
Some((s.read::<u16>()?, s.read::<u16>()?))
172174
}

0 commit comments

Comments
 (0)