diff options
author | James Zern <jzern@google.com> | 2013-03-20 12:59:29 -0700 |
---|---|---|
committer | James Zern <jzern@google.com> | 2013-03-20 13:59:22 -0700 |
commit | 302efcdb41a83a648a9b92df5e26fc3b7b8841f0 (patch) | |
tree | 0050727fa065e39bd165cd84c4a39fd822cb2928 | |
parent | ad452735c363843a0764b7ba4b24eb52b705ecb2 (diff) | |
download | libwebp-302efcdb41a83a648a9b92df5e26fc3b7b8841f0.tar.gz |
Decode: return more meaningful error for animation
VP8_STATUS_NOT_ENOUGH_DATA -> VP8_STATUS_UNSUPPORTED_FEATURE
Change-Id: If5ee9fd2c99fc5502996d3c786848fd9cc118fe7
-rw-r--r-- | src/dec/webp.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/dec/webp.c b/src/dec/webp.c index 10b2e264..39d90188 100644 --- a/src/dec/webp.c +++ b/src/dec/webp.c @@ -372,10 +372,19 @@ static VP8StatusCode ParseHeadersInternal(const uint8_t* data, } VP8StatusCode WebPParseHeaders(WebPHeaderStructure* const headers) { + VP8StatusCode status; + int has_animation = 0; assert(headers != NULL); - // fill out headers, ignore width/height/has_alpha/has_animation. - return ParseHeadersInternal(headers->data, headers->data_size, - NULL, NULL, NULL, NULL, headers); + // fill out headers, ignore width/height/has_alpha. + status = ParseHeadersInternal(headers->data, headers->data_size, + NULL, NULL, NULL, &has_animation, headers); + if (status == VP8_STATUS_OK || status == VP8_STATUS_NOT_ENOUGH_DATA) { + // TODO(jzern): full support of animation frames will require API additions. + if (has_animation) { + status = VP8_STATUS_UNSUPPORTED_FEATURE; + } + } + return status; } //------------------------------------------------------------------------------ |