Merge pull request #2095 from dreampiggy/fix_progressive_webp_decode_y_zero

Fix WebP progressive decoding may do extra calculate
This commit is contained in:
Bogdan Poplauschi 2017-11-05 12:24:39 +02:00 committed by GitHub
commit 8f04ef7394
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -166,7 +166,8 @@
int last_y = 0;
int stride = 0;
uint8_t *rgba = WebPIDecGetRGB(_idec, &last_y, &width, &height, &stride);
if (width + height > 0 && height >= last_y) {
// last_y may be 0, means no enough bitmap data to decode, ignore this
if (width + height > 0 && last_y > 0 && height >= last_y) {
// Construct a UIImage from the decoded RGBA value array
CGDataProviderRef provider =
CGDataProviderCreateWithData(NULL, rgba, 0, NULL);