[packages/libcaca] Rel 3. Fix CVE-2026-42046 and CVE-2022-0856.
arekm
arekm at pld-linux.org
Thu Nov 26 08:42:00 CET 2026
commit a25510d99649df771c6cc5272069f9968b4c881c
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Thu Nov 26 00:19:52 2026 +0100
Rel 3. Fix CVE-2026-42046 and CVE-2022-0856.
libcaca-img2txt-zero-size.patch | 19 +++++++++++++++++++
libcaca-overflow-check.patch | 28 ++++++++++++++++++++++++++++
libcaca.spec | 6 +++++-
3 files changed, 52 insertions(+), 1 deletion(-)
---
diff --git a/libcaca.spec b/libcaca.spec
index 94490e2..9b053a2 100644
--- a/libcaca.spec
+++ b/libcaca.spec
@@ -14,7 +14,7 @@
%undefine with_dotnet
%endif
-%define rel 2
+%define rel 3
%define subver beta20
Summary: Graphics library that outputs text instead of pixels
Summary(pl.UTF-8): Biblioteka graficzna wyświetlająca tekst zamiast pikseli
@@ -33,6 +33,8 @@ Patch3: %{name}-plugins.patch
Patch4: %{name}-javah.patch
Patch5: ruby-c99.patch
Patch6: typed-ruby.patch
+Patch7: %{name}-overflow-check.patch
+Patch8: %{name}-img2txt-zero-size.patch
URL: http://caca.zoy.org/wiki/libcaca
BuildRequires: OpenGL-devel
BuildRequires: autoconf >= 2.50
@@ -283,6 +285,8 @@ Wiązania języka Ruby do libcaca.
%patch -P4 -p1
%patch -P5 -p1
%patch -P6 -p1
+%patch -P7 -p1
+%patch -P8 -p1
%build
%{__libtoolize}
diff --git a/libcaca-img2txt-zero-size.patch b/libcaca-img2txt-zero-size.patch
new file mode 100644
index 0000000..942faa0
--- /dev/null
+++ b/libcaca-img2txt-zero-size.patch
@@ -0,0 +1,19 @@
+# CVE-2022-0856: img2txt divide by zero on zero-sized image; https://github.com/cacalabs/libcaca/issues/65
+diff --git a/src/img2txt.c b/src/img2txt.c
+index b8a2589..70a7446 100644
+--- a/src/img2txt.c
++++ b/src/img2txt.c
+@@ -176,6 +176,13 @@ int main(int argc, char **argv)
+ return 1;
+ }
+
++ if(!i->w || !i->h)
++ {
++ fprintf(stderr, "%s: image %s has invalid dimensions %ldx%ld\n", argv[0], argv[argc-1], i->w, i->h);
++ caca_free_canvas(cv);
++ return 1;
++ }
++
+ /* Assume a 6×10 font */
+ if(!cols && !lines)
+ {
diff --git a/libcaca-overflow-check.patch b/libcaca-overflow-check.patch
new file mode 100644
index 0000000..e9144c1
--- /dev/null
+++ b/libcaca-overflow-check.patch
@@ -0,0 +1,28 @@
+# CVE-2026-42046: signed overflow in canvas size check; upstream fb77acff9ba6bb01d53940da34fb10f20b156a23
+diff --git a/caca/canvas.c b/caca/canvas.c
+index 7beff5b81d47..62b72b72bb5e 100644
+--- a/caca/canvas.c
++++ b/caca/canvas.c
+@@ -26,6 +26,7 @@
+ # if defined(HAVE_UNISTD_H)
+ # include <unistd.h>
+ # endif
++# include <limits.h>
+ #endif
+
+ #include "caca.h"
+@@ -368,12 +369,12 @@ int caca_resize(caca_canvas_t *cv, int width, int height)
+ int x, y, f, old_width, old_height, old_size;
+
+ /* Check for overflow */
+- int new_size = width * height;
+- if (new_size < 0 || (width > 0 && new_size / width != height))
++ if (width != 0 && height > INT_MAX / width)
+ {
+ seterrno(EOVERFLOW);
+ return -1;
+ }
++ int new_size = width * height;
+
+ old_width = cv->width;
+ old_height = cv->height;
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/libcaca.git/commitdiff/a25510d99649df771c6cc5272069f9968b4c881c
More information about the pld-cvs-commit
mailing list