diff --git a/platform/default/webp_reader.cpp b/platform/default/webp_reader.cpp index 37d23da11..5b0eaf474 100644 --- a/platform/default/webp_reader.cpp +++ b/platform/default/webp_reader.cpp @@ -15,8 +15,11 @@ PremultipliedImage decodeWebP(const uint8_t* data, size_t size) { throw std::runtime_error("failed to retrieve WebP basic header information"); } - std::unique_ptr webp(WebPDecodeRGBA(data, size, &width, &height)); - if (!webp) { + int stride = width * 4; + size_t webpSize = stride * height; + auto webp = std::make_unique(webpSize); + + if (!WebPDecodeRGBAInto(data, size, webp.get(), webpSize, stride)) { throw std::runtime_error("failed to decode WebP data"); }