From 956b217a8bc043fa085f0cb80c38dba8a4e961e4 Mon Sep 17 00:00:00 2001 From: Urvang Joshi Date: Wed, 27 Feb 2013 15:27:43 -0800 Subject: [PATCH] WebPGetFeatures() behavior change: It should return VP8_STATUS_NOT_ENOUGH_DATA when it doesn't have enough data. Change-Id: I5acff04f9ba51dab150dc6d137c5ad00ea61c64a --- src/dec/webp.c | 8 +------- src/webp/decode.h | 5 +++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/dec/webp.c b/src/dec/webp.c index 84f0460e..34480474 100644 --- a/src/dec/webp.c +++ b/src/dec/webp.c @@ -672,19 +672,13 @@ int WebPInitDecoderConfigInternal(WebPDecoderConfig* config, VP8StatusCode WebPGetFeaturesInternal(const uint8_t* data, size_t data_size, WebPBitstreamFeatures* features, int version) { - VP8StatusCode status; if (WEBP_ABI_IS_INCOMPATIBLE(version, WEBP_DECODER_ABI_VERSION)) { return VP8_STATUS_INVALID_PARAM; // version mismatch } if (features == NULL) { return VP8_STATUS_INVALID_PARAM; } - - status = GetFeatures(data, data_size, features); - if (status == VP8_STATUS_NOT_ENOUGH_DATA) { - return VP8_STATUS_BITSTREAM_ERROR; // Not-enough-data treated as error. - } - return status; + return GetFeatures(data, data_size, features); } VP8StatusCode WebPDecode(const uint8_t* data, size_t data_size, diff --git a/src/webp/decode.h b/src/webp/decode.h index d82daa0a..40f6d693 100644 --- a/src/webp/decode.h +++ b/src/webp/decode.h @@ -411,8 +411,9 @@ WEBP_EXTERN(VP8StatusCode) WebPGetFeaturesInternal( // Retrieve features from the bitstream. The *features structure is filled // with information gathered from the bitstream. -// Returns false in case of error or version mismatch. -// In case of error, features->bitstream_status will reflect the error code. +// Returns VP8_STATUS_OK when the features are successfully retrieved. Returns +// VP8_STATUS_NOT_ENOUGH_DATA when more data is needed to retrieved the +// features. Returns error in other cases. static WEBP_INLINE VP8StatusCode WebPGetFeatures( const uint8_t* data, size_t data_size, WebPBitstreamFeatures* features) {