File gdk-pixbuf-fix-decoder-written-bytes-reporting.patch of Package gdk-pixbuf

From c4986342b241cdc075259565f3fa7a7597d32a32 Mon Sep 17 00:00:00 2001
From: lumi <lumi@suwi.moe>
Date: Sat, 7 Jun 2025 22:27:06 +0200
Subject: [PATCH] lzw: Fix reporting of bytes written in decoder

When the LZW decoder encounters an invalid code, it stops
processing the image and returns the whole buffer size.
It should return the amount of bytes written, instead.

Fixes #257
---
 gdk-pixbuf/lzw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdk-pixbuf/lzw.c b/gdk-pixbuf/lzw.c
index 15293560b..4f3dd8beb 100644
--- a/gdk-pixbuf/lzw.c
+++ b/gdk-pixbuf/lzw.c
@@ -208,7 +208,7 @@ lzw_decoder_feed (LZWDecoder *self,
                                 /* Invalid code received - just stop here */
                                 if (self->code >= self->code_table_size) {
                                         self->last_code = self->eoi_code;
-                                        return output_length;
+                                        return n_written;
                                 }
 
                                 /* Convert codeword into indexes */
-- 
GitLab

openSUSE Build Service is sponsored by