summaryrefslogtreecommitdiff
path: root/media/libwebp/demux
diff options
context:
space:
mode:
authorJustOff <Off.Just.Off@gmail.com>2018-06-29 20:57:44 +0300
committerJustOff <Off.Just.Off@gmail.com>2018-06-29 20:57:44 +0300
commitb2d288f1d7857773498b0722afc6175b6a1f75cf (patch)
tree8b51f96dd85bb3253c0c61fa2b214465d53a95ed /media/libwebp/demux
parent749ffb07e63350304ac177f3d09916f0aef1aae7 (diff)
downloaduxp-b2d288f1d7857773498b0722afc6175b6a1f75cf.tar.gz
Sync libwebp sources with https://chromium.googlesource.com/webm/libwebp/+/v1.0.0
Diffstat (limited to 'media/libwebp/demux')
-rw-r--r--media/libwebp/demux/demux.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/media/libwebp/demux/demux.c b/media/libwebp/demux/demux.c
index 100eab8c01..aec2a0a2d1 100644
--- a/media/libwebp/demux/demux.c
+++ b/media/libwebp/demux/demux.c
@@ -23,9 +23,9 @@
#include "../webp/demux.h"
#include "../webp/format_constants.h"
-#define DMUX_MAJ_VERSION 0
-#define DMUX_MIN_VERSION 3
-#define DMUX_REV_VERSION 2
+#define DMUX_MAJ_VERSION 1
+#define DMUX_MIN_VERSION 0
+#define DMUX_REV_VERSION 0
typedef struct {
size_t start_; // start location of the data
@@ -205,12 +205,14 @@ static void SetFrameInfo(size_t start_offset, size_t size,
frame->complete_ = complete;
}
-// Store image bearing chunks to 'frame'.
+// Store image bearing chunks to 'frame'. 'min_size' is an optional size
+// requirement, it may be zero.
static ParseStatus StoreFrame(int frame_num, uint32_t min_size,
MemBuffer* const mem, Frame* const frame) {
int alpha_chunks = 0;
int image_chunks = 0;
- int done = (MemDataSize(mem) < min_size);
+ int done = (MemDataSize(mem) < CHUNK_HEADER_SIZE ||
+ MemDataSize(mem) < min_size);
ParseStatus status = PARSE_OK;
if (done) return PARSE_NEED_MORE_DATA;
@@ -401,9 +403,9 @@ static ParseStatus ParseSingleImage(WebPDemuxer* const dmux) {
frame = (Frame*)WebPSafeCalloc(1ULL, sizeof(*frame));
if (frame == NULL) return PARSE_ERROR;
- // For the single image case we allow parsing of a partial frame, but we need
- // at least CHUNK_HEADER_SIZE for parsing.
- status = StoreFrame(1, CHUNK_HEADER_SIZE, &dmux->mem_, frame);
+ // For the single image case we allow parsing of a partial frame, so no
+ // minimum size is imposed here.
+ status = StoreFrame(1, 0, &dmux->mem_, frame);
if (status != PARSE_ERROR) {
const int has_alpha = !!(dmux->feature_flags_ & ALPHA_FLAG);
// Clear any alpha when the alpha flag is missing.