public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/stb] epel10.3: Update to 0^20261009.a7d4c21
@ 2026-10-22 16:22 Benjamin A. Beasley
  0 siblings, 0 replies; only message in thread
From: Benjamin A. Beasley @ 2026-10-22 16:22 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/stb
            Branch : epel10.3
            Commit : 53c971741275ed41d36d6d919c29dcc404994b88
            Author : Benjamin A. Beasley <code@musicinmybrain.net>
            Date   : 2026-10-19T13:57:55+01:00
            Stats  : +99/-59 in 5 file(s)
            URL    : https://src.fedoraproject.org/rpms/stb/c/53c971741275ed41d36d6d919c29dcc404994b88?branch=epel10.3

            Log:
            Update to 0^20261009.a7d4c21

- Drop the stb_sprintf library, now developed in a separate repository
- Keep the stb_image_resize2 library, which is also now developed in a
  separate repository, until we can package it separately

---
diff --git a/1995.patch b/1995.patch
deleted file mode 100644
index 1e279cd..0000000
--- a/1995.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 1fd7ff9fdb97f301264226302a4d70b1074a6b66 Mon Sep 17 00:00:00 2001
-From: Brandon Barrante <aetherai@aethersystems.net>
-Date: Sun, 6 Sep 2026 19:04:39 -0400
-Subject: [PATCH] stb_sprintf: don't write buf[-1] on snprintf(buf, 0, ...)
- (fixes #1963)
-
-The top gate in STB_SPRINTF_DECORATE(vsnprintf) only entered the count-only path when both count == 0 AND buf was NULL. A caller passing a valid buffer with count == 0 (the shape callers use to ask 'how big would this be?') fell through to the else branch, computed l = (int)(c.buf - buf) = 0, hit the l >= count clamp, dropped to l = count - 1 = -1, and executed buf[-1] = 0 -- one byte out-of-bounds before the caller's buffer.
-
-The C standard is explicit that snprintf(buf, 0, ...) must not write. glibc, musl and the BSD snprintf all skip the null terminator when count == 0.
-
-Extend the gate to count <= 0 so the count-only path handles both the null-buf and the non-null-buf cases the same way. The count-only path uses stbsp__count_clamp_callback which only accumulates length and never dereferences buf, so it's safe with buf == NULL. Behavior for count > 0 is unchanged.
-
-Verified under ASan/UBSan on master 2c980bb5: stack layout puts pad_after immediately before buf; before the fix, snprintf(buf, 0, ...) sets pad_after[15] to 0x00; after the fix it stays as 'B'. Positive controls (normal snprintf, truncation, count=1, count=0-with-null-buf) all still pass.
-
-Fixes: #1963
-Reported-by: JerryGW (github.com/JerryGW)
-Signed-off-by: Brandon Barrante <aetherai@aethersystems.net>
----
- stb_sprintf.h | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/stb_sprintf.h b/stb_sprintf.h
-index ca432a6bca..6625d6eed0 100644
---- a/stb_sprintf.h
-+++ b/stb_sprintf.h
-@@ -1431,8 +1431,12 @@ STBSP__PUBLICDEF int STB_SPRINTF_DECORATE( vsnprintf )( char * buf, int count, c
- {
-    stbsp__context c;
- 
--   if ( (count == 0) && !buf )
-+   if ( count <= 0 )
-    {
-+      // C standard: snprintf(buf, 0, ...) writes nothing, returns the count
-+      // the full output would have taken. Handle this whether or not the
-+      // caller passed a valid buffer -- writing buf[count - 1] with count == 0
-+      // is an out-of-bounds write before the caller's buffer.
-       c.length = 0;
- 
-       STB_SPRINTF_DECORATE( vsprintfcb )( stbsp__count_clamp_callback, &c, c.tmp, fmt, va );

diff --git a/cve-2026-79516.patch b/cve-2026-79516.patch
new file mode 100644
index 0000000..fe5a425
--- /dev/null
+++ b/cve-2026-79516.patch
@@ -0,0 +1,18 @@
+diff --git a/deprected/stb_sprintf.h b/deprected/stb_sprintf.h
+index ca432a6bca..6625d6eed0 100644
+--- a/deprecated/stb_sprintf.h
++++ b/deprecated/stb_sprintf.h
+@@ -1431,8 +1431,12 @@ STBSP__PUBLICDEF int STB_SPRINTF_DECORATE( vsnprintf )( char * buf, int count, c
+ {
+    stbsp__context c;
+ 
+-   if ( (count == 0) && !buf )
++   if ( count <= 0 )
+    {
++      // C standard: snprintf(buf, 0, ...) writes nothing, returns the count
++      // the full output would have taken. Handle this whether or not the
++      // caller passed a valid buffer -- writing buf[count - 1] with count == 0
++      // is an out-of-bounds write before the caller's buffer.
+       c.length = 0;
+ 
+       STB_SPRINTF_DECORATE( vsprintfcb )( stbsp__count_clamp_callback, &c, c.tmp, fmt, va );

diff --git a/fix-riscv64-compile-uintptr.patch b/fix-riscv64-compile-uintptr.patch
index d00bb5d..512fa64 100644
--- a/fix-riscv64-compile-uintptr.patch
+++ b/fix-riscv64-compile-uintptr.patch
@@ -1,7 +1,7 @@
-diff --git a/stb_sprintf.h b/stb_sprintf.h
+diff --git a/deprecated/stb_sprintf.h b/deprecated/stb_sprintf.h
 index ca432a6..fb49e4d 100644
---- a/stb_sprintf.h
-+++ b/stb_sprintf.h
+--- a/deprecated/stb_sprintf.h
++++ b/deprecated/stb_sprintf.h
 @@ -230,7 +230,7 @@ STBSP__PUBLICDEC void STB_SPRINTF_DECORATE(set_separators)(char comma, char peri
  #define stbsp__uint16 unsigned short
  

diff --git a/sources b/sources
index a8d3ac4..0083692 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-SHA512 (stb-2c980bb59875b0d32144a71867fbdebb2f77cd20.tar.gz) = 93db78589d836b5a8924ed0e980c6fd8d1dbc7e2d0489bc5a0fa4dedd73ed94332e5c814adc2976e89fab3f4cd96b5c46beae7b5dd55bc8374a91390d774b2b0
+SHA512 (stb-a7d4c2175630e1ea5b6f8dd00ab96fed0b97b96d.tar.gz) = c8d29594dc98d599451bc4eda4a263c1c59751767de382c622a804bb86357e85edc1cd087b910cc64f7ce27a2e49f6623214e07600bf1e7bf432186a9e0dcc01

diff --git a/stb.spec b/stb.spec
index 8579419..48ef948 100644
--- a/stb.spec
+++ b/stb.spec
@@ -1,13 +1,13 @@
-%global commit 2c980bb59875b0d32144a71867fbdebb2f77cd20
-%global snapdate 20260802
+%global commit a7d4c2175630e1ea5b6f8dd00ab96fed0b97b96d
+%global snapdate 20261009
 
 # We choose not to package the “stb_include” library (stb_include.h) because,
 # during the package review, it was observed that it follows coding practices
 # that make it dangerous to use on untrusted inputs, including but not limited
 # to:
 #
-# - It uses of strcat/strcpy into a fixed-length buffer that is assumed (but
-#   not proven) to be large enough for all possible uses
+# - It uses strcat/strcpy into a fixed-length buffer that is assumed (but not
+#   proven) to be large enough for all possible uses
 # - It ignores I/O errors (possibly leading to undefined behavior from reading
 #   uninitialized memory), and so on.
 #
@@ -16,6 +16,22 @@
 # necessary rewrite may be done and offered upstream. For now, we omit the
 # library and expect it will not be missed.
 %bcond stb_include 0
+# This is deprecated upstream in favor of stb_image_resize2, but we haven’t
+# deprecated it downstream, and things still depend on it. If the
+# stb_image_resize-devel binary package ever becomes a leaf, then we should
+# drop it.
+%bcond stb_image_resize 1
+# This is deprecated upstream as an stb library; it’s actively developed, but
+# in a separate repository, https://github.com/nothings/stb_image_resize2.
+# We continue to ship the copy from the deprecated/ directory until we can
+# introduce a new source package to replace it.
+%bcond stb_image_resize2 1
+# This is deprecated upstream as an stb library; it’s actively developed, but
+# in a separate repository, https://github.com/nothings/stb_sprintf, and a new
+# source package should be introduced if stb_sprintf is ever needed at all.
+# We continue to ship the copy from the deprecated/ directory in stable
+# releases for backwards-compatibility.
+%bcond stb_sprintf %[ %{defined fc45} || %{defined fc44} || %{defined fc43} || %{defined el10} ]
 
 Name:           stb
 # While the individual header-only libraries are versioned, the overall
@@ -269,7 +285,7 @@ Patch:          issue-1929.patch
 #
 # Patch rejected upstream without comment, presumably because the PR was
 # drafted with AI/LLM assistance.
-Patch:          %{url}/pull/1995.patch
+Patch:          cve-2026-79516.patch
 
 %global stb_c_lexer_version 0.12
 %global stb_connected_components_version 0.96
@@ -280,14 +296,22 @@ Patch:          %{url}/pull/1995.patch
 %global stb_herringbone_wang_tile_version 0.7
 %global stb_hexwave_version 0.5
 %global stb_image_version 2.30
+%if %{with stb_image_resize}
 %global stb_image_resize_version 0.97
+%endif
+%if %{with stb_image_resize2}
 %global stb_image_resize2_version 2.18
+%endif
 %global stb_image_write_version 1.16
+%if %{with stb_include}
 %global stb_include_version 0.2
+%endif
 %global stb_leakcheck_version 0.6
 %global stb_perlin_version 0.5
 %global stb_rect_pack_version 1.1
+%if %{with stb_sprintf}
 %global stb_sprintf_version 1.10
+%endif
 %global stb_textedit_version 1.14
 %global stb_tilemap_editor_version 0.42
 %global stb_truetype_version 1.26
@@ -337,14 +361,16 @@ Requires:       stb_hexwave-static = %{stb_hexwave_version}%{snapinfo}-%{release
 Requires:       stb_image-devel%{?_isa} = %{stb_image_version}%{snapinfo}-%{release}
 Requires:       stb_image-static = %{stb_image_version}%{snapinfo}-%{release}
 # For compatibility, we still depend on the subpackages for the original,
-# deprecated-upstream stb_image_library in existing stable releases, but we
-# drop the dependendency going forward as an acknowledgement of its status.
-%if 0%{?el9} || 0%{?el8}
+# deprecated-upstream stb_image_resize library in existing stable releases, but
+# we drop the dependendency going forward as an acknowledgement of its status.
+%if %{with stb_image_resize} && %[ %{defined el9} || %{defined el8} ]
 Requires:       stb_image_resize-devel%{?_isa} = %{stb_image_resize_version}%{snapinfo}-%{release}
 Requires:       stb_image_resize-static = %{stb_image_resize_version}%{snapinfo}-%{release}
 %endif
+%if %{with stb_image_resize2}
 Requires:       stb_image_resize2-devel%{?_isa} = %{stb_image_resize2_version}%{snapinfo}-%{release}
 Requires:       stb_image_resize2-static = %{stb_image_resize2_version}%{snapinfo}-%{release}
+%endif
 Requires:       stb_image_write-devel%{?_isa} = %{stb_image_write_version}%{snapinfo}-%{release}
 Requires:       stb_image_write-static = %{stb_image_write_version}%{snapinfo}-%{release}
 %if %{with stb_include}
@@ -357,8 +383,10 @@ Requires:       stb_perlin-devel%{?_isa} = %{stb_perlin_version}%{snapinfo}-%{re
 Requires:       stb_perlin-static = %{stb_perlin_version}%{snapinfo}-%{release}
 Requires:       stb_rect_pack-devel%{?_isa} = %{stb_rect_pack_version}%{snapinfo}-%{release}
 Requires:       stb_rect_pack-static = %{stb_rect_pack_version}%{snapinfo}-%{release}
+%if %{with stb_sprintf}
 Requires:       stb_sprintf-devel%{?_isa} = %{stb_sprintf_version}%{snapinfo}-%{release}
 Requires:       stb_sprintf-static = %{stb_sprintf_version}%{snapinfo}-%{release}
+%endif
 Requires:       stb_textedit-devel%{?_isa} = %{stb_textedit_version}%{snapinfo}-%{release}
 Requires:       stb_textedit-static = %{stb_textedit_version}%{snapinfo}-%{release}
 Requires:       stb_tilemap_editor-devel%{?_isa} = %{stb_tilemap_editor_version}%{snapinfo}-%{release}
@@ -523,9 +551,7 @@ Primarily of interest to game developers and other people who can avoid
 problematic images and only need the trivial interface.
 
 
-# We still package (and have chosen not to deprecate) the original
-# stb_image_resize even though upstream has deprecated it. We do not want to
-# drive dependent packages back to bundling.
+%if %{with stb_image_resize}
 %package -n stb_image_resize-devel
 Summary:        Resize images larger/smaller with good quality (original version)
 Version:        %{stb_image_resize_version}%{snapinfo}
@@ -543,8 +569,10 @@ w/Mitchell filter, upsamples w/cubic interpolation.
 
 This is the original version of the stb_image_resize library. It has been
 deprecated by its developer; consider porting to stb_image_resize2 instead.
+%endif
 
 
+%if %{with stb_image_resize2}
 %package -n stb_image_resize2-devel
 Summary:        Resize images larger/smaller with good quality
 Version:        %{stb_image_resize2_version}%{snapinfo}
@@ -554,6 +582,7 @@ Provides:       stb_image_resize2-static = %{stb_image_resize2_version}%{snapinf
 
 %description -n stb_image_resize2-devel
 Image resizing.
+%endif
 
 
 %package -n stb_image_write-devel
@@ -640,6 +669,7 @@ Please note: better rectangle packers are welcome! Please implement them to the
 same API, but with a different init function.
 
 
+%if %{with stb_sprintf}
 %package -n stb_sprintf-devel
 Summary:        Fast sprintf, snprintf for C/C++
 Version:        %{stb_sprintf_version}%{snapinfo}
@@ -670,6 +700,7 @@ most platforms.
 
 It compiles to roughly 8K with float support, and 4K without. As a comparison,
 when using MSVC static libs, calling sprintf drags in 16K.
+%endif
 
 
 %package -n stb_textedit-devel
@@ -815,9 +846,14 @@ find . -type f -name '*.exe' -print -delete
 
 # Remove some unused parts of the source tree that could contribute different
 # (but acceptable) license terms if they were used—just to prove that we do not
-# use them.
+# use them. We keep some more recently deprecated libraries because they don’t
+# have weird licenses and it’s easier than disconnecting them from the tests.
 rm --recursive --verbose tests/caveview
-find deprecated -type f ! -name 'stb_image_resize.h' -print -delete
+find deprecated -type f \
+     ! -name stb_image_resize.h \
+     ! -name stb_image_resize2.h \
+     ! -name stb_sprintf.h \
+     -print -delete
 
 %if %{without stb_include}
 sed --regexp-extended --in-place \
@@ -828,7 +864,7 @@ sed --regexp-extended --in-place \
 %build
 # There is no compiled code to install, since all stb libraries are
 # header-only. We do need to build the tests.
-%make_build --directory=tests
+%make_build --directory=tests INCLUDES='-I.. -I../deprecated'
 
 
 %install
@@ -845,11 +881,22 @@ sed --regexp-extended --in-place \
 # library without having to make their own local symlinks or patch their
 # sources.
 install -D --preserve-timestamps --mode=0644 \
-    --target='%{buildroot}%{_includedir}/stb' \
-    stb_*.h stb_*.c deprecated/stb_image_resize.h
+    --target='%{buildroot}%{_includedir}/stb' stb_*.h stb_*.c
 %if %{without stb_include}
 rm '%{buildroot}%{_includedir}/stb/stb_include.h'
 %endif
+%if %{with stb_image_resize}
+install -D --preserve-timestamps --mode=0644 \
+    --target='%{buildroot}%{_includedir}/stb' deprecated/stb_image_resize.h
+%endif
+%if %{with stb_image_resize2}
+install -D --preserve-timestamps --mode=0644 \
+    --target='%{buildroot}%{_includedir}/stb' deprecated/stb_image_resize2.h
+%endif
+%if %{with stb_sprintf}
+install -D --preserve-timestamps --mode=0644 \
+    --target='%{buildroot}%{_includedir}/stb' deprecated/stb_sprintf.h
+%endif
 pushd '%{buildroot}%{_includedir}'
 ln --symbolic --verbose stb/stb_*.? .
 popd
@@ -894,14 +941,22 @@ done <<'EOF'
 %{stb_herringbone_wang_tile_version} stb_herringbone_wang_tile.h
 %{stb_hexwave_version} stb_hexwave.h
 %{stb_image_version} stb_image.h
+%if %{with stb_image_resize}
 %{stb_image_resize_version} stb_image_resize.h
+%endif
+%if %{with stb_image_resize2}
 %{stb_image_resize2_version} stb_image_resize2.h
+%endif
 %{stb_image_write_version} stb_image_write.h
+%if %{with stb_include}
 %{stb_include_version} stb_include.h
+%endif
 %{stb_leakcheck_version} stb_leakcheck.h
 %{stb_perlin_version} stb_perlin.h
 %{stb_rect_pack_version} stb_rect_pack.h
+%if %{with stb_sprintf}
 %{stb_sprintf_version} stb_sprintf.h
+%endif
 %{stb_textedit_version} stb_textedit.h
 %{stb_tilemap_editor_version} stb_tilemap_editor.h
 %{stb_truetype_version} stb_truetype.h
@@ -993,20 +1048,24 @@ EOF
 %{_includedir}/stb_image.h
 
 
+%if %{with stb_image_resize}
 %files -n stb_image_resize-devel
 %license LICENSE
 # Directory has shared ownership across stb subpackages:
 %dir %{_includedir}/stb
 %{_includedir}/stb/stb_image_resize.h
 %{_includedir}/stb_image_resize.h
+%endif
 
 
+%if %{with stb_image_resize2}
 %files -n stb_image_resize2-devel
 %license LICENSE
 # Directory has shared ownership across stb subpackages:
 %dir %{_includedir}/stb
 %{_includedir}/stb/stb_image_resize2.h
 %{_includedir}/stb_image_resize2.h
+%endif
 
 
 %files -n stb_image_write-devel
@@ -1051,12 +1110,14 @@ EOF
 %{_includedir}/stb_rect_pack.h
 
 
+%if %{with stb_sprintf}
 %files -n stb_sprintf-devel
 %license LICENSE
 # Directory has shared ownership across stb subpackages:
 %dir %{_includedir}/stb
 %{_includedir}/stb/stb_sprintf.h
 %{_includedir}/stb_sprintf.h
+%endif
 
 
 %files -n stb_textedit-devel

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-22 16:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-22 16:22 [rpms/stb] epel10.3: Update to 0^20261009.a7d4c21 Benjamin A. Beasley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox