aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2017-06-04 14:38:24 +0200
committerKostya Shishkov <kostya.shishkov@gmail.com>2017-06-04 14:38:24 +0200
commitf6fa6f3404393e399a05c5d5cda7a35c4e41fb4a (patch)
tree79b43d44de88c12809866c97f2b2e93b91bf24c3 /src
parent6c8e5c40938d4e34f062b53e9ad0d4bd6b147b26 (diff)
downloadnihav-f6fa6f3404393e399a05c5d5cda7a35c4e41fb4a.tar.gz
AVI: align parsed chunks
Diffstat (limited to 'src')
-rw-r--r--src/demuxers/avi.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/demuxers/avi.rs b/src/demuxers/avi.rs
index 56cf023..2a3f8f0 100644
--- a/src/demuxers/avi.rs
+++ b/src/demuxers/avi.rs
@@ -148,6 +148,7 @@ impl<'a> AVIDemuxer<'a> {
if RIFFTag::Chunk(tag) == CHUNKS[i].tag {
let psize = (CHUNKS[i].parse)(self, size)?;
if psize != size { return Err(InvalidData); }
+ if (psize & 1) == 1 { self.src.read_skip(1)?; }
return Ok((size + 8, false));
}
if RIFFTag::List(tag, ltag) == CHUNKS[i].tag {
@@ -159,12 +160,18 @@ impl<'a> AVIDemuxer<'a> {
let (psize, _) = self.parse_chunk(end_tag, rest_size, depth+1)?;
if psize > rest_size { return Err(InvalidData); }
rest_size -= psize;
+ if (psize & 1) == 1 {
+ if rest_size > 0 {
+ rest_size -= 1;
+ }
+ }
}
return Ok((size + 8, false));
}
}
self.src.read_skip(size)?;
+ if (size & 1) == 1 { self.src.read_skip(1)?; }
return Ok((size + 8, false));
}