std/webp: tweak workbuf_len determination

This commit is contained in:
Nigel Tao committed 2026-08-10 09:23:05 +10:00
1 parent c4df79d82e
commit 466cf6f15d
12 files changed
+106 -90

No files matched your search

+3
View File
@@ -518,6 +518,9 @@ redirect:
// Allocate the work buffer. Wuffs' decoders conventionally assume that this
// can be uninitialized memory.
wuffs_base__range_ii_u64 workbuf_len = image_decoder->workbuf_len();
if (workbuf_len.is_empty()) {
return DecodeImageResult(DecodeImage_UnsupportedImageFormat);
}
DecodeImageCallbacks::AllocWorkbufResult alloc_workbuf_result =
callbacks.AllocWorkbuf(workbuf_len, true);
if (!alloc_workbuf_result.error_message.empty()) {
+2
View File
@@ -162,6 +162,8 @@ class DecodeImageCallbacks {
// should be at least len_range.min_incl, but larger allocations (up to
// len_range.max_incl) may have better performance (by using more memory).
//
// The len_range argument will satisfy !len_range.is_empty().
//
// The default AllocWorkbuf implementation allocates len_range.max_incl bytes
// of either uninitialized or zeroed memory.
virtual AllocWorkbufResult //