From 94101d81d75a0e0781c17c7a044a317cfa9f0098 Mon Sep 17 00:00:00 2001 From: Comfy Org PR Bot Date: Wed, 11 Feb 2026 11:51:54 +0900 Subject: [PATCH] [backport core/1.38] fix: handle RIFF padding for odd-sized WEBP chunks (#8794) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport of #8527 to `core/1.38` Automatically created by backport workflow. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8794-backport-core-1-38-fix-handle-RIFF-padding-for-odd-sized-WEBP-chunks-3046d73d36508174afc8cdd8cd791169) by [Unito](https://www.unito.io) Co-authored-by: Christian Byrne Co-authored-by: GitHub Action --- src/scripts/pnginfo.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/scripts/pnginfo.ts b/src/scripts/pnginfo.ts index 58fe2da0f2..d0b6ee3e4d 100644 --- a/src/scripts/pnginfo.ts +++ b/src/scripts/pnginfo.ts @@ -124,7 +124,9 @@ export function getWebpMetadata(file: File) { break } - offset += 8 + chunk_length + // RIFF spec requires odd-sized chunks to be padded with a single byte + // https://developers.google.com/speed/webp/docs/riff_container#riff_file_format + offset += 8 + chunk_length + (chunk_length % 2) } r(txt_chunks)