* update libcaca to 0.99.beta20-4

This commit is contained in:
Alexander Baldeck 2024-05-11 21:57:01 +02:00
parent 76a96c101a
commit a2f50aac50
2 changed files with 52 additions and 4 deletions

View File

@ -5,16 +5,26 @@
pkgname=libcaca
pkgver=0.99.beta20
pkgrel=2
pkgrel=4
pkgdesc='Color ASCII art library'
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
url='http://caca.zoy.org/wiki/libcaca'
license=('custom:WTFPL')
license=('WTFPL')
depends=('freeglut' 'gcc-libs' 'glibc' 'glu' 'imlib2' 'libglvnd' 'libx11' 'ncurses' 'slang' 'zlib')
makedepends=('doxygen' 'pango' 'python')
options=(!lto)
optdepends=('python: Python bindings')
source=("https://github.com/cacalabs/libcaca/releases/download/v$pkgver/$pkgname-$pkgver.tar.bz2")
sha256sums=('ff9aa641af180a59acedc7fc9e663543fb397ff758b5122093158fd628125ac1')
source=("https://github.com/cacalabs/libcaca/releases/download/v$pkgver/$pkgname-$pkgver.tar.bz2"
'libcaca-0.99.beta20-CVE-2022-0856.patch')
sha256sums=('ff9aa641af180a59acedc7fc9e663543fb397ff758b5122093158fd628125ac1'
'242308d530e20f018c1a275a90c0697b107bf2bfd28e928610bbbe80707bdeef')
prepare() {
cd $pkgname-$pkgver
# Prevent a divide-by-zero by checking for a zero width or height
# https://github.com/cacalabs/libcaca/pull/66
patch -Np1 -i ../libcaca-0.99.beta20-CVE-2022-0856.patch
}
build() {
cd $pkgname-$pkgver

View File

@ -0,0 +1,38 @@
From d33a9ca2b7e9f32483c1aee4c3944c56206d456b Mon Sep 17 00:00:00 2001
From: Josef Moellers <jmoellers@suse.de>
Date: Fri, 18 Mar 2022 11:52:22 +0100
Subject: [PATCH] Prevent a divide-by-zero by checking for a zero width or
height.
---
src/img2txt.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/img2txt.c b/src/img2txt.c
index b8a25899..b9d5ba24 100644
--- a/src/img2txt.c
+++ b/src/img2txt.c
@@ -177,7 +177,13 @@ int main(int argc, char **argv)
}
/* Assume a 6×10 font */
- if(!cols && !lines)
+ if(!i->w || !i->h)
+ {
+ fprintf(stderr, "%s: image size is 0\n", argv[0]);
+ lines = 0;
+ cols = 0;
+ }
+ else if(!cols && !lines)
{
cols = 60;
lines = cols * i->h * font_width / i->w / font_height;
@@ -214,7 +220,7 @@ int main(int argc, char **argv)
export = caca_export_canvas_to_memory(cv, format?format:"ansi", &len);
if(!export)
{
- fprintf(stderr, "%s: Can't export to format '%s'\n", argv[0], format);
+ fprintf(stderr, "%s: Can't export to format '%s'\n", argv[0], format?format:"ansi");
}
else
{