From f07b2138cd4d5a8aa0276d007c4fa5c773da6f0a Mon Sep 17 00:00:00 2001 From: Vikas Arora Date: Mon, 31 Oct 2011 04:38:25 +0000 Subject: [PATCH] Rectify the Chunk parsing logic. For odd-sized chunk-payload, there's one Byte padding at the end to make the next chunk start at even-address. The chunk-skip logic needs to be updated to handle such cases. Change-Id: I8939ed07584a6195092fbe703eb0ea711fa5f153 --- src/dec/webp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dec/webp.c b/src/dec/webp.c index 91ac75f7..bde28b50 100644 --- a/src/dec/webp.c +++ b/src/dec/webp.c @@ -131,7 +131,8 @@ VP8StatusCode WebPParseOptionalChunks(const uint8_t** data, uint32_t* data_size, } chunk_size = get_le32(buf + TAG_SIZE); - cur_skip_size = CHUNK_HEADER_SIZE + chunk_size; + // For odd-sized chunk-payload, there's one Byte padding at the end. + cur_skip_size = (CHUNK_HEADER_SIZE + chunk_size + 1) & ~1; // Check that total bytes skipped along with current chunk size // does not exceed riff_size.