mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-20 04:18:26 +01:00
Merge "additional fix for stride type as size_t"
This commit is contained in:
commit
265abbe9b2
@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
#include "webp/encode.h"
|
#include "webp/encode.h"
|
||||||
#include "webp/mux_types.h"
|
#include "webp/mux_types.h"
|
||||||
#include "webp/format_constants.h"
|
|
||||||
|
|
||||||
#define GIF_TRANSPARENT_COLOR 0x00000000
|
#define GIF_TRANSPARENT_COLOR 0x00000000
|
||||||
#define GIF_WHITE_COLOR 0xffffffff
|
#define GIF_WHITE_COLOR 0xffffffff
|
||||||
@ -111,8 +110,7 @@ int GIFReadFrame(GifFileType* const gif, int transparent_index,
|
|||||||
int ok = 0;
|
int ok = 0;
|
||||||
*gif_rect = rect;
|
*gif_rect = rect;
|
||||||
|
|
||||||
if (memory_needed != (size_t)memory_needed ||
|
if (memory_needed != (size_t)memory_needed || memory_needed > (4ULL << 32)) {
|
||||||
memory_needed > 4 * MAX_IMAGE_AREA) {
|
|
||||||
fprintf(stderr, "Image is too large (%d x %d).", rect.width, rect.height);
|
fprintf(stderr, "Image is too large (%d x %d).", rect.width, rect.height);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -135,12 +133,13 @@ int GIFReadFrame(GifFileType* const gif, int transparent_index,
|
|||||||
const int interlace_jumps[] = { 8, 8, 4, 2 };
|
const int interlace_jumps[] = { 8, 8, 4, 2 };
|
||||||
int pass;
|
int pass;
|
||||||
for (pass = 0; pass < 4; ++pass) {
|
for (pass = 0; pass < 4; ++pass) {
|
||||||
int y;
|
const size_t stride = (size_t)sub_image.argb_stride;
|
||||||
for (y = interlace_offsets[pass]; y < rect.height;
|
int y = interlace_offsets[pass];
|
||||||
y += interlace_jumps[pass]) {
|
uint32_t* row = dst + y * stride;
|
||||||
|
const size_t jump = interlace_jumps[pass] * stride;
|
||||||
|
for (; y < rect.height; y += interlace_jumps[pass], row += jump) {
|
||||||
if (DGifGetLine(gif, tmp, rect.width) == GIF_ERROR) goto End;
|
if (DGifGetLine(gif, tmp, rect.width) == GIF_ERROR) goto End;
|
||||||
Remap(gif, tmp, rect.width, transparent_index,
|
Remap(gif, tmp, rect.width, transparent_index, row);
|
||||||
dst + y * (size_t)sub_image.argb_stride);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // Non-interlaced image.
|
} else { // Non-interlaced image.
|
||||||
|
Loading…
Reference in New Issue
Block a user