From 779d05dbfc93a4824d8cde0f1f9cb6ebafa740ff Mon Sep 17 00:00:00 2001 From: vrabaud Date: Fri, 27 Oct 2023 01:11:53 -0700 Subject: [PATCH] No public description PiperOrigin-RevId: 577114064 Change-Id: I62d81773b9a3105df7df86b904ea9dba5d90d593 --- tensorstore/internal/image/webp_reader.cc | 4 +++- tensorstore/internal/image/webp_writer.cc | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tensorstore/internal/image/webp_reader.cc b/tensorstore/internal/image/webp_reader.cc index 5e8188bbf..d33ab36f1 100644 --- a/tensorstore/internal/image/webp_reader.cc +++ b/tensorstore/internal/image/webp_reader.cc @@ -112,7 +112,9 @@ absl::Status WebPReader::Context::Init() { absl::Status WebPReader::Context::Decode(tensorstore::span dest, const WebPReaderOptions& options) { WebPDecBuffer buf; - WebPInitDecBuffer(&buf); + if (!WebPInitDecBuffer(&buf)) { + return absl::InternalError("Failed to init WEBP decoder buffer"); + } buf.colorspace = features_.has_alpha ? MODE_RGBA : MODE_RGB; buf.u.RGBA.rgba = dest.data(); buf.u.RGBA.stride = features_.width * (features_.has_alpha ? 4 : 3); diff --git a/tensorstore/internal/image/webp_writer.cc b/tensorstore/internal/image/webp_writer.cc index 016fdcd3c..5e0a67754 100644 --- a/tensorstore/internal/image/webp_writer.cc +++ b/tensorstore/internal/image/webp_writer.cc @@ -68,7 +68,9 @@ absl::Status EncodeWebP(riegeli::Writer* writer, ABSL_CHECK(WebPValidateConfig(&config)); WebPPicture pic; - WebPPictureInit(&pic); + if (!WebPPictureInit(&pic)) { + return absl::InternalError("WEBP picture init failed"); + } pic.width = info.width; pic.height = info.height; pic.writer = WebPWriterWrite;