public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/libcue] f44: Fix regressions test on 32-bit arches
@ 2026-11-18 11:01 Peter Lemenkov
0 siblings, 0 replies; only message in thread
From: Peter Lemenkov @ 2026-11-18 11:01 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/libcue
Branch : f44
Commit : 3c4d013564fb4d2f24c4cc985cda3e2dede27d21
Author : Peter Lemenkov <lemenkov@gmail.com>
Date : 2026-11-18T11:51:01+01:00
Stats : +56/-0 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/libcue/c/3c4d013564fb4d2f24c4cc985cda3e2dede27d21?branch=f44
Log:
Fix regressions test on 32-bit arches
parse_number() saturated at LONG_MAX, which equals INT_MAX on ILP32, so
an overlong frame count was accepted as INT_MAX instead of rejected.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
diff --git a/libcue-0001-Reject-out-of-range-numbers-on-ILP32-too.patch b/libcue-0001-Reject-out-of-range-numbers-on-ILP32-too.patch
new file mode 100644
index 0000000..b7e9efd
--- /dev/null
+++ b/libcue-0001-Reject-out-of-range-numbers-on-ILP32-too.patch
@@ -0,0 +1,54 @@
+From 5529f81e6a9917d51222212c743c8b4e619b710a Mon Sep 17 00:00:00 2001
+From: Peter Lemenkov <lemenkov@gmail.com>
+Date: Wed, 18 Nov 2026 11:46:23 +0100
+Subject: [PATCH 1/1] Reject out-of-range numbers on ILP32 too
+
+parse_number() saturated at LONG_MAX, and the parser rejected values
+above INT_MAX. Where long is 32 bits wide (i686, armv7hl, ...),
+LONG_MAX == INT_MAX, so an overlong bare frame count such as
+"INDEX 02 99999999999999999999" became a valid time of INT_MAX frames
+instead of being rejected, and the regressions test failed:
+
+ numbers: bogus INDEX 02
+
+All numbers in a cue sheet have to fit an int, so return -1 for
+anything larger. Every consumer already treats a negative value as
+invalid.
+
+Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ cue_scanner.l | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/cue_scanner.l b/cue_scanner.l
+index 77e8016..4d923f3 100644
+--- a/cue_scanner.l
++++ b/cue_scanner.l
+@@ -24,15 +24,20 @@ static char *set_string(struct cue_parser_state *st, const char *s, size_t len)
+ return st->string;
+ }
+
+-/* Convert a run of decimal digits, saturating at LONG_MAX instead of overflowing. */
++/*
++ * Convert a run of decimal digits. Every number in a cue sheet must fit
++ * an int, so anything larger is returned as -1, which the parser rejects.
++ * (Saturating at LONG_MAX does not work where long is as wide as int:
++ * LONG_MAX == INT_MAX there, and the value would be taken as valid.)
++ */
+ static long parse_number(const char *s)
+ {
+ long v = 0;
+
+ for (; *s >= '0' && *s <= '9'; s++) {
+ int d = *s - '0';
+- if (v > (LONG_MAX - d) / 10)
+- return LONG_MAX;
++ if (v > (INT_MAX - d) / 10)
++ return -1;
+ v = v * 10 + d;
+ }
+ return v;
+--
+2.56.0
+
diff --git a/libcue.spec b/libcue.spec
index 1ed9900..549db36 100644
--- a/libcue.spec
+++ b/libcue.spec
@@ -7,6 +7,8 @@ License: GPL-2.0-only AND BSD-2-Clause
URL: https://github.com/lipnitsk/%{name}
VCS: git:%{url}.git
Source: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
+# https://github.com/lipnitsk/libcue/pull/90
+Patch: libcue-0001-Reject-out-of-range-numbers-on-ILP32-too.patch
BuildRequires: bison
BuildRequires: cmake
BuildRequires: flex
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-18 11:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18 11:01 [rpms/libcue] f44: Fix regressions test on 32-bit arches Peter Lemenkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox