summaryrefslogtreecommitdiff
path: root/dev-games/libsmacker
diff options
context:
space:
mode:
authorroot <root@alpha.trunkmasters.com>2026-06-12 19:09:37 -0500
committerroot <root@alpha.trunkmasters.com>2026-06-12 19:09:37 -0500
commitb590c8d7572b727d565cc0b8ff660d43569845de (patch)
tree06f7a4102ea4e845df8b66660f252920d52952f9 /dev-games/libsmacker
parent24f9cbfc4c34fdb6a6e03311674414e881ceab47 (diff)
downloadbaldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.tar.gz
baldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.tar.xz
baldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.zip
Adding metadata
Diffstat (limited to 'dev-games/libsmacker')
-rw-r--r--dev-games/libsmacker/Manifest1
-rw-r--r--dev-games/libsmacker/files/libsmacker-1.2.0-palette_renderer.patch63
-rw-r--r--dev-games/libsmacker/libsmacker-1.2.0_p43-r1.ebuild34
-rw-r--r--dev-games/libsmacker/libsmacker-1.2.0_p43.ebuild31
-rw-r--r--dev-games/libsmacker/metadata.xml13
5 files changed, 142 insertions, 0 deletions
diff --git a/dev-games/libsmacker/Manifest b/dev-games/libsmacker/Manifest
new file mode 100644
index 000000000000..a889ab91b4ed
--- /dev/null
+++ b/dev-games/libsmacker/Manifest
@@ -0,0 +1 @@
+DIST libsmacker-1.2.0_p43.tar.gz 27766 BLAKE2B 783b05a66fbf5b0b1344e0b00e06a3edce3eb8c30e189d343869eb8866266ea9204ab1d1821f1f455f63fb365622630cb5da042a1b6650a7d166d5c62d217ac9 SHA512 1785b000884a6f93b621c1503adef100ac9b8c6e7ed5ef4d85b9ea4819715c40f9af3d930490b33ca079f531103acc69de2a800756ed7678c820ff155f86aaeb
diff --git a/dev-games/libsmacker/files/libsmacker-1.2.0-palette_renderer.patch b/dev-games/libsmacker/files/libsmacker-1.2.0-palette_renderer.patch
new file mode 100644
index 000000000000..30560a933bc3
--- /dev/null
+++ b/dev-games/libsmacker/files/libsmacker-1.2.0-palette_renderer.patch
@@ -0,0 +1,63 @@
+https://github.com/greg-kennedy/libsmacker/pull/2
+From: Matt Jolly <kangie@gentoo.org>
+Date: Sun, 22 Feb 2026 10:30:19 +1000
+Subject: [PATCH] fix: Remove spurious overlap check in palette_render 0x40
+ handler
+
+The colour-shift (0x40) handler in smk_render_palette copies entries
+from oldPalette into s->palette:
+
+ memmove(&s->palette[i][0], &oldPalette[src][0], count * 3);
+
+These are two separate memory regions: oldPalette is a static local
+snapshot taken via memcpy at function entry, while s->palette is part
+of the smk_video_t struct on the heap. They can never alias.
+
+Despite this, the bounds check rejects palette deltas where the source
+and destination *index* ranges overlap:
+
+ if (src < i && src + count > i)
+
+This conflates array indices with memory addresses. Since the source
+and destination are different buffers, overlapping index ranges are
+perfectly valid.
+
+The result is that any palette delta where a lower-numbered source
+entry is copied to a higher-numbered destination entry (encountered in
+the wild in e.g. JA2 intro videos) gets incorrectly rejected, causing
+smk_render_palette to bail out with an overflow error. Consumers then
+see a half-constructed palette, producing corrupted or flickering
+colours.
+
+Commit bea19c1 (2017-01-27, SVN r31) changed palette storage from a flat
+malloc'd pointer to an embedded [256][3] array and eliminated the temp
+buffer, making the 0x40 handler copy within the same s->palette array.
+Commit 2042bd7 (2017-01-27, SVN r32) then correctly added this overlap
+guard and switched memcpy to memmove to protect against in-place
+forward-copy corruption. Two years later, commit 0464fbb (2019-01-31,
+SVN r34) fixed the aliasing problem properly by introducing a static
+oldPalette snapshot and reading from that instead, but did not remove
+the now-redundant overlap check which has been silently rejecting valid
+palette deltas ever since.
+
+Signed-off-by: Matt Jolly <kangie@gentoo.org>
+---
+ smacker.c | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/smacker.c b/smacker.c
+index eef6e7b..724b0fe 100644
+--- a/smacker.c
++++ b/smacker.c
+@@ -1224,9 +1224,8 @@ static char smk_render_palette(struct smk_video_t * s, unsigned char * p, unsign
+ p ++;
+ size --;
+
+- /* overflow: see if we write/read beyond 256colors, or overwrite own palette */
+- if (i + count > 256 || src + count > 256 ||
+- (src < i && src + count > i)) {
++ /* overflow: see if we write/read beyond 256 colors */
++ if (i + count > 256 || src + count > 256) {
+ fprintf(stderr, "libsmacker::palette_render(s,p,size) - ERROR: overflow, 0x40 attempt to copy %d entries from %d to %d\n", count, src, i);
+ goto error;
+ }
diff --git a/dev-games/libsmacker/libsmacker-1.2.0_p43-r1.ebuild b/dev-games/libsmacker/libsmacker-1.2.0_p43-r1.ebuild
new file mode 100644
index 000000000000..258bb0f89a1b
--- /dev/null
+++ b/dev-games/libsmacker/libsmacker-1.2.0_p43-r1.ebuild
@@ -0,0 +1,34 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=9
+
+inherit autotools
+
+DESCRIPTION="A cross-platform C library for decoding .smk Smacker Video files"
+HOMEPAGE="https://libsmacker.sourceforge.net"
+SRC_URI="https://sourceforge.net/projects/libsmacker/files/libsmacker-$(ver_cut 1-2)/${P/_p/r}.tar.gz/download -> ${P}.tar.gz"
+S="${WORKDIR}/${PN}-$(ver_cut 1-3)"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86"
+
+src_prepare() {
+ PATCHES=(
+ "${FILESDIR}/libsmacker-1.2.0-palette_renderer.patch"
+ )
+ default
+ eautoreconf
+}
+
+src_install() {
+ default
+
+ insinto /usr/include
+ doins smacker.h
+
+ # No .la files or static libraries
+ find "${ED}" -name '*.la' -delete || die
+ find "${ED}" -name '*.a' -delete || die
+}
diff --git a/dev-games/libsmacker/libsmacker-1.2.0_p43.ebuild b/dev-games/libsmacker/libsmacker-1.2.0_p43.ebuild
new file mode 100644
index 000000000000..7ba231b236e0
--- /dev/null
+++ b/dev-games/libsmacker/libsmacker-1.2.0_p43.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools
+
+DESCRIPTION="A cross-platform C library for decoding .smk Smacker Video files"
+HOMEPAGE="https://libsmacker.sourceforge.net"
+SRC_URI="https://sourceforge.net/projects/libsmacker/files/libsmacker-$(ver_cut 1-2)/${P/_p/r}.tar.gz/download -> ${P}.tar.gz"
+S="${WORKDIR}/${PN}-$(ver_cut 1-3)"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86"
+
+src_prepare() {
+ default
+ eautoreconf
+}
+
+src_install() {
+ default
+
+ insinto /usr/include
+ doins smacker.h
+
+ # No .la files or static libraries
+ find "${ED}" -name '*.la' -delete || die
+ find "${ED}" -name '*.a' -delete || die
+}
diff --git a/dev-games/libsmacker/metadata.xml b/dev-games/libsmacker/metadata.xml
new file mode 100644
index 000000000000..d820c4ed047e
--- /dev/null
+++ b/dev-games/libsmacker/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://docs.baldeagleos.com/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person" proxied="yes">
+ <email>misanthropos@gmx.net</email>
+ <name>Richard Fröhning</name>
+ </maintainer>
+ <maintainer type="project" proxied="proxy">
+ <email>proxy-maint@gentoo.org</email>
+ <name>Proxy Maintainers</name>
+ </maintainer>
+ <origin>baldeagleos-repo</origin>
+</pkgmetadata>