public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Michel Lind <salimma@fedoraproject.org>
To: git-commits@fedoraproject.org
Subject: [rpms/jigdo] f44: Fix assertion error triggered by out-of-bound access
Date: Fri, 21 Aug 2026 17:33:06 GMT	[thread overview]
Message-ID: <178733358629.1.6156181079343164808.rpms-jigdo-2f161aaaf515@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/jigdo
            Branch : f44
            Commit : 2f161aaaf51564dfbfcb56550aaff0e2870ba201
            Author : Michel Lind <salimma@fedoraproject.org>
            Date   : 2026-08-21T18:04:33+01:00
            Stats  : +45/-131 in 6 file(s)
            URL    : https://src.fedoraproject.org/rpms/jigdo/c/2f161aaaf51564dfbfcb56550aaff0e2870ba201?branch=f44

            Log:
            Fix assertion error triggered by out-of-bound access

Signed-off-by: Michel Lind <salimma@fedoraproject.org>

---
diff --git a/jigdo-0.7.1-debug.patch b/jigdo-0.7.1-debug.patch
deleted file mode 100644
index 08326f1..0000000
--- a/jigdo-0.7.1-debug.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up jigdo-0.7.3/configure.debug jigdo-0.7.3/configure
---- jigdo-0.7.3/configure.debug	2006-05-19 17:16:14.000000000 -0400
-+++ jigdo-0.7.3/configure	2008-08-05 11:03:24.000000000 -0400
-@@ -2676,8 +2676,6 @@ ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS 
- ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
- ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
- 
--CFLAGS=`echo "$CFLAGS" | sed 's/\(^\| \)-g\( \|$\)/ /'`
--CXXFLAGS=`echo "$CXXFLAGS" | sed 's/\(^\| \)-g\( \|$\)/ /'`
- IF_GXX2="#"
- IFNOT_GXX2=""
- if test "$GXX" = yes; then

diff --git a/jigdo-0.7.3-gcc43.patch b/jigdo-0.7.3-gcc43.patch
deleted file mode 100644
index 07356f0..0000000
--- a/jigdo-0.7.3-gcc43.patch
+++ /dev/null
@@ -1,80 +0,0 @@
-diff -ur jigdo-0.7.3.orig/src/compat.hh jigdo-0.7.3/src/compat.hh
---- jigdo-0.7.3.orig/src/compat.hh	2005-07-02 10:21:35.000000000 -0700
-+++ jigdo-0.7.3/src/compat.hh	2008-03-11 23:01:45.000000000 -0700
-@@ -20,6 +20,7 @@
- 
- #include <string>
- #include <stdio.h>
-+#include <stdlib.h>
- #include <unistd-jigdo.h>
- #include <sys/stat.h>
- #include <sys/types.h>
-diff -ur jigdo-0.7.3.orig/src/gtk/gtk-single-url.cc jigdo-0.7.3/src/gtk/gtk-single-url.cc
---- jigdo-0.7.3.orig/src/gtk/gtk-single-url.cc	2005-10-15 14:27:39.000000000 -0700
-+++ jigdo-0.7.3/src/gtk/gtk-single-url.cc	2008-03-11 23:05:48.000000000 -0700
-@@ -15,6 +15,7 @@
- 
- #include <time.h>
- #include <errno.h>
-+#include <string.h>
- 
- #include <autoptr.hh>
- #include <gtk-single-url.hh>
-diff -ur jigdo-0.7.3.orig/src/gtk/jigdo.cc jigdo-0.7.3/src/gtk/jigdo.cc
---- jigdo-0.7.3.orig/src/gtk/jigdo.cc	2005-07-09 15:21:04.000000000 -0700
-+++ jigdo-0.7.3/src/gtk/jigdo.cc	2008-03-11 23:06:26.000000000 -0700
-@@ -16,6 +16,8 @@
- #  include <unistd-jigdo.h>
- #endif
- 
-+#include <string.h>
-+
- #include <iostream>
- #include <string>
- #include <vector>
-diff -ur jigdo-0.7.3.orig/src/recursedir.cc jigdo-0.7.3/src/recursedir.cc
---- jigdo-0.7.3.orig/src/recursedir.cc	2006-05-14 11:23:31.000000000 -0700
-+++ jigdo-0.7.3/src/recursedir.cc	2008-03-11 23:04:21.000000000 -0700
-@@ -32,6 +32,7 @@
- #include <recursedir.hh>
- 
- #include <iostream>
-+#include <string.h>
- #include <errno.h>
- #include <sys/stat.h>
- #include <sys/types.h>
-diff -ur jigdo-0.7.3.orig/src/util/configfile.cc jigdo-0.7.3/src/util/configfile.cc
---- jigdo-0.7.3.orig/src/util/configfile.cc	2003-09-27 14:31:04.000000000 -0700
-+++ jigdo-0.7.3/src/util/configfile.cc	2008-03-11 23:05:00.000000000 -0700
-@@ -19,6 +19,8 @@
- #include <iostream>
- #include <fstream>
- 
-+#include <string.h>
-+
- #include <configfile.hh>
- #include <string.hh>
- //______________________________________________________________________
-diff -ur jigdo-0.7.3.orig/src/util/md5sum.hh jigdo-0.7.3/src/util/md5sum.hh
---- jigdo-0.7.3.orig/src/util/md5sum.hh	2005-04-09 16:09:52.000000000 -0700
-+++ jigdo-0.7.3/src/util/md5sum.hh	2008-03-11 23:07:04.000000000 -0700
-@@ -28,6 +28,8 @@
- 
- #include <config.h>
- 
-+#include <string.h>
-+
- #include <cstdlib>
- #include <iosfwd>
- #include <string>
-diff -ur jigdo-0.7.3.orig/src/util/string-utf.cc jigdo-0.7.3/src/util/string-utf.cc
---- jigdo-0.7.3.orig/src/util/string-utf.cc	2004-09-11 16:26:30.000000000 -0700
-+++ jigdo-0.7.3/src/util/string-utf.cc	2008-03-11 23:07:43.000000000 -0700
-@@ -15,6 +15,7 @@
- #include <glib.h>
- #include <stdarg.h>
- #include <stdio.h>
-+#include <string.h>
- 
- #include <debug.hh>
- #include <string-utf.hh>

diff --git a/jigdo-0.7.3-gcc7.patch b/jigdo-0.7.3-gcc7.patch
deleted file mode 100644
index d5f0c8a..0000000
--- a/jigdo-0.7.3-gcc7.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-diff -Naur jigdo-0.7.3.orig/src/mkimage.cc jigdo-0.7.3/src/mkimage.cc
---- jigdo-0.7.3.orig/src/mkimage.cc	2005-07-09 21:14:46.000000000 +0200
-+++ jigdo-0.7.3/src/mkimage.cc	2017-02-17 14:47:12.884488507 +0100
-@@ -285,27 +285,27 @@
- //______________________________________________________________________
- 
- namespace {
--  const int SIZE_WIDTH = 12;
-+  const int size_width = 12;
- }
- 
- ostream& JigdoDesc::ImageInfo::put(ostream& s) const {
--  s << "image-info  " << setw(SIZE_WIDTH) << size() << "              "
-+  s << "image-info  " << setw(size_width) << size() << "              "
-     << md5() << ' ' << blockLength() << '\n';
-   return s;
- }
- ostream& JigdoDesc::UnmatchedData::put(ostream& s) const {
--  s << "in-template " << setw(SIZE_WIDTH) << offset() << ' '
--    << setw(SIZE_WIDTH) << size() << '\n';
-+  s << "in-template " << setw(size_width) << offset() << ' '
-+    << setw(size_width) << size() << '\n';
-   return s;
- }
- ostream& JigdoDesc::MatchedFile::put(ostream& s) const {
--  s << "need-file   " << setw(SIZE_WIDTH) << offset() << ' '
--    << setw(SIZE_WIDTH) << size() << ' ' << md5() << ' ' << rsync() << '\n';
-+  s << "need-file   " << setw(size_width) << offset() << ' '
-+    << setw(size_width) << size() << ' ' << md5() << ' ' << rsync() << '\n';
-   return s;
- }
- ostream& JigdoDesc::WrittenFile::put(ostream& s) const {
--  s << "have-file   " << setw(SIZE_WIDTH) << offset() << ' '
--    << setw(SIZE_WIDTH) << size() << ' ' << md5() << ' ' << rsync() << '\n';
-+  s << "have-file   " << setw(size_width) << offset() << ' '
-+    << setw(size_width) << size() << ' ' << md5() << ' ' << rsync() << '\n';
-   return s;
- }
- 

diff --git a/jigdo-0.8.2-configfile-empty-line.patch b/jigdo-0.8.2-configfile-empty-line.patch
new file mode 100644
index 0000000..d2c81d5
--- /dev/null
+++ b/jigdo-0.8.2-configfile-empty-line.patch
@@ -0,0 +1,41 @@
+From b27a3243728773cbe999cf3805ce47aaf114b923 Mon Sep 17 00:00:00 2001
+From: Michel Lind <michel@michel-slm.name>
+Date: Fri, 21 Aug 2026 17:50:02 +0100
+Subject: [PATCH] ConfigFile: Only check the last character of the text if it's
+ non-empty
+
+`ConfigFile::get()` unconditionally evaluated `text[text.length() - 1]`
+to check for a Windows CRLF line ending.
+
+With an empty line this wraps around to `SIZE_MAX`, causing an
+out-of-bound access. This fails if jigdo is built with
+`-D_GLIBCXX_ASSERTIONS`
+
+e.g. for the Fedora EPEL 8 build:
+
+/usr/include/c++/8/bits/basic_string.h:1071: std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator[](std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference = char&; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]: Assertion '__pos <= size()' failed.
+
+See https://bugzilla.redhat.com/show_bug.cgi?id=2515970
+
+Signed-off-by: Michel Lind <michel@michel-slm.name>
+---
+ src/util/configfile.cc | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/util/configfile.cc b/src/util/configfile.cc
+index 012a9d9..7e1aa90 100644
+--- a/src/util/configfile.cc
++++ b/src/util/configfile.cc
+@@ -160,7 +160,8 @@ istream& ConfigFile::get(istream& s) {
+   while (true) {
+     getline(s, text);
+     // Tolerate Doze "CRLF"-style line endings under Unix
+-    if (text[text.length() - 1] == '\r') text.resize(text.length() - 1);
++    if (!text.empty() && text[text.length() - 1] == '\r')
++      text.resize(text.length() - 1);
+     if (!s) break;
+     push_back();
+     swap(text, back());
+-- 
+2.55.0
+

diff --git a/jigdo.spec b/jigdo.spec
index c8a85b3..9dfdfa0 100644
--- a/jigdo.spec
+++ b/jigdo.spec
@@ -12,6 +12,8 @@ Source2:       https://www.einval.com/~steve/pgp/587979573442684E.asc
 Source3:       jigdo.desktop
 # fix doc SGML sources e.g. for missing end tags
 Patch:         %{name}-0.8.1-fix-docs.patch
+# fix assertion error triggered by out-of-bound access
+Patch:         %{name}-0.8.2-configfile-empty-line.patch
 
 BuildRequires: bzip2-devel
 BuildRequires: curl-devel

diff --git a/series b/series
new file mode 100644
index 0000000..c17eb2a
--- /dev/null
+++ b/series
@@ -0,0 +1,2 @@
+jigdo-0.8.1-fix-docs.patch
+jigdo-0.8.2-configfile-empty-line.patch

                 reply	other threads:[~2026-08-21 17:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178733358629.1.6156181079343164808.rpms-jigdo-2f161aaaf515@fedoraproject.org \
    --to=salimma@fedoraproject.org \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox