Package: libimlib2
Version: 1.7.4-2
Severity: normal
Tags: patch

imlib2 fails to load some tga images, the bug was first discovered and
determined on: https://codeberg.org/nsxiv/nsxiv/issues/378

it was also discovered that the issue affects multiple versions of imlib2
and may have been present since imlib2 first supported tga images, the bug
does affect the versions of imlib2 from debian stable up to the latest upstream
release at the time of writing (1.9.1), the patch has already been merged into
the upstream, on the meantime here is the patch inlined:


>From 322582c4d02d9ed98badd28218d54c86683d80b2 Mon Sep 17 00:00:00 2001
From: NRK <n...@disroot.org>
Date: Sun, 9 Oct 2022 12:56:57 +0600
Subject: [PATCH] TGA loader: fix indexing in tgaflip

`y` needs to be multiplied by the width, not the height.

ref: https://codeberg.org/nsxiv/nsxiv/issues/378
---
 src/modules/loaders/loader_tga.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/modules/loaders/loader_tga.c
b/src/modules/loaders/loader_tga.c
index 992a8d8..e0312fa 100644
--- a/src/modules/loaders/loader_tga.c
+++ b/src/modules/loaders/loader_tga.c
@@ -481,9 +481,9 @@ tgaflip(uint32_t * in, int w, int h, int fliph, int flipv)
         x2 = fliph ? w - 1 : 0;
         for (x = 0; x < nx; x++, x2 += dx)
           {
-             tmp = in[y * h + x];
-             in[y * h + x] = in[y2 * h + x2];
-             in[y2 * h + x2] = tmp;
+             tmp = in[y * w + x];
+             in[y * w + x] = in[y2 * w + x2];
+             in[y2 * w + x2] = tmp;
           }
      }
 }
--
2.35.1



-- System Information:
Debian Release: bookworm/sid
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.18.0-3-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
LSM: AppArmor: enabled

Versions of packages libimlib2 depends on:
ii  libbz2-1.0       1.0.8-5
ii  libc6            2.34-3
ii  libfreetype6     2.12.1+dfsg-3
ii  libgif7          5.2.1-2.5
ii  libid3tag0       0.15.1b-14
ii  libjpeg62-turbo  1:2.1.2-1
ii  libpng16-16      1.6.37-5
ii  libtiff5         4.4.0-4
ii  libwebp7         1.2.2-2+b1
ii  libx11-6         2:1.8.1-2
ii  libx11-xcb1      2:1.8.1-2
ii  libxcb-shm0      1.15-1
ii  libxcb1          1.15-1
ii  libxext6         2:1.3.4-1
ii  zlib1g           1:1.2.11.dfsg-4

libimlib2 recommends no packages.

libimlib2 suggests no packages.

-- no debconf information

Reply via email to