diff -up libwebp-0.3.0/src/enc/alpha.c.mozilla-1819244 libwebp-0.3.0/src/enc/alpha.c --- libwebp-0.3.0/src/enc/alpha.c.mozilla-1819244 2013-03-29 23:55:16.000000000 +0100 +++ libwebp-0.3.0/src/enc/alpha.c 2023-04-26 12:06:31.017969727 +0200 @@ -123,8 +123,8 @@ static int EncodeAlphaInternal(const uin header = method | (filter << 2); if (reduce_levels) header |= ALPHA_PREPROCESSED_LEVELS << 4; - VP8BitWriterInit(bw, expected_size); - VP8BitWriterAppend(bw, &header, ALPHA_HEADER_LEN); + ok = VP8BitWriterInit(bw, expected_size); + ok = ok && VP8BitWriterAppend(bw, &header, ALPHA_HEADER_LEN); filter_func = WebPFilters[filter]; if (filter_func != NULL) { @@ -135,7 +135,7 @@ static int EncodeAlphaInternal(const uin } if (method == ALPHA_NO_COMPRESSION) { - ok = VP8BitWriterAppend(bw, alpha_src, width * height); + ok = ok && VP8BitWriterAppend(bw, alpha_src, width * height); ok = ok && !bw->error_; } else { ok = EncodeLossless(alpha_src, width, height, effort_level, bw, stats);