public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Mamoru TASAKA <mtasaka@fedoraproject.org>
To: git-commits@fedoraproject.org
Subject: [rpms/libfm] rawhide: Apply upstream PR to fix g_realloc / memmove incorrect usage detected with
Date: Wed, 10 Jun 2026 15:18:48 GMT [thread overview]
Message-ID: <178110472861.1.10838438364060046023.rpms-libfm-79463231e118@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/libfm
Branch : rawhide
Commit : 79463231e118adf193697c110ad17cf6b006e520
Author : Mamoru TASAKA <mtasaka@fedoraproject.org>
Date : 2026-06-11T00:18:34+09:00
Stats : +45/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/libfm/c/79463231e118adf193697c110ad17cf6b006e520?branch=rawhide
Log:
Apply upstream PR to fix g_realloc / memmove incorrect usage detected with
gcc17 -fanalyzer
---
diff --git a/libfm-pr124-g-udisks-volume-fix-incorrect-g_realloc-and-memcpy-u.patch b/libfm-pr124-g-udisks-volume-fix-incorrect-g_realloc-and-memcpy-u.patch
new file mode 100644
index 0000000..aae9fb4
--- /dev/null
+++ b/libfm-pr124-g-udisks-volume-fix-incorrect-g_realloc-and-memcpy-u.patch
@@ -0,0 +1,35 @@
+From 5e80ea4e18dd4fa75310b98b8021ac86448e3dc7 Mon Sep 17 00:00:00 2001
+From: Mamoru TASAKA <mtasaka@fedoraproject.org>
+Date: Wed, 10 Jun 2026 23:28:07 +0900
+Subject: [PATCH] g-udisks-volume: fix incorrect g_realloc and memcpy usage
+
+gcc17 -fanalyzer warns:
+src/udisks/g-udisks-volume.c:302:45: warning: allocated buffer size is not a multiple of the pointee's size [CWE-131] [-Wanalyzer-allocation-size]
+
+Actually:
+1. The second argument of g_realloc: "+2" is apparently wrong: it should be `len + 2`, also should be multiplied by the size of element.
+2. The direction (in other words, the first and second arguments) of memcpy is swapped. The latter line seems to be trying to prepend `OUT_mount_path` to mount_paths, so mount_paths[0] should be moved to mount_paths[1]
+3. `data->vol->dev->mount_paths + sizeof(char*)` points to the `sizeof(char*)`-th element of `mount_paths` (starting at 0), which is apparently not intended: which should be 1th element (starting at 0).
+4. Using `memcpy` for overwrapping region is incorrect. That should be `memmove`.
+5. `len` value, which is the result of `g_strv_length`, does not count the last NULL sentinel. So to count the size of `memmove`, the last NULL sentinel must be considered.
+
+This change fixes the above issues.
+---
+ src/udisks/g-udisks-volume.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/udisks/g-udisks-volume.c b/src/udisks/g-udisks-volume.c
+index a1a4a98f..2ff0a110 100644
+--- a/src/udisks/g-udisks-volume.c
++++ b/src/udisks/g-udisks-volume.c
+@@ -299,8 +299,8 @@ static void mount_callback(DBusGProxy *proxy, char * OUT_mount_path, GError *err
+ if(!*p) /* OUT_mount_path is not in mount_paths */
+ {
+ int len = g_strv_length(data->vol->dev->mount_paths);
+- data->vol->dev->mount_paths = g_realloc(data->vol->dev->mount_paths, + 2);
+- memcpy(data->vol->dev->mount_paths, data->vol->dev->mount_paths + sizeof(char*), len * sizeof(char*));
++ data->vol->dev->mount_paths = g_realloc(data->vol->dev->mount_paths, (len + 2) * sizeof(char*));
++ memmove(data->vol->dev->mount_paths + 1, data->vol->dev->mount_paths, (len + 1) * sizeof(char*));
+ data->vol->dev->mount_paths[0] = g_strdup(OUT_mount_path);
+ }
+ }
diff --git a/libfm.spec b/libfm.spec
index 26ab2b6..265c8f4 100644
--- a/libfm.spec
+++ b/libfm.spec
@@ -45,7 +45,7 @@
Name: libfm
Version: %{main_version}%{git_ver_rpm}
-Release: 5%{?dist}
+Release: 6%{?dist}
Summary: GIO-based library for file manager-like programs
# src/actions/ GPL-2.0-or-later
@@ -90,6 +90,9 @@ Patch1001: libfm-pr119-suppress-gfileinfo-warnings.patch
# https://github.com/lxde/libfm/pull/121
# Suppress GObject related warnings
Patch1002: libfm-pr121-suppress-gobject-warnings.patch
+# https://github.com/lxde/libfm/pull/124
+# g-udisks-volume: fix incorrect g_realloc and memcpy usage detected with gcc17 -Wanalyzer-allocation-size)
+Patch1003: libfm-pr124-g-udisks-volume-fix-incorrect-g_realloc-and-memcpy-u.patch
BuildRequires: pkgconfig(gio-unix-2.0) >= 2.26.0
BuildRequires: pkgconfig(glib-2.0) >= 2.27.0
@@ -277,6 +280,7 @@ cat %PATCH1 | git am
git commit -m "Use gtk version specific module directory" -a
cat %PATCH1001 | git am
cat %PATCH1002 | git am
+cat %PATCH1003 | git am
# Need reporting upstream
# ref: https://github.com/lxde/libfm/commit/1af95bd8f26cab6848a74b7e02b53c6c79fb53a5
@@ -305,6 +309,7 @@ find . -name \*.vala | xargs touch
%build
+%global _pkg_extra_cflags -fanalyzer
%if 0%{?use_gitbare} >= 1
cd libfm
%endif
@@ -511,6 +516,10 @@ fi
%endif
%changelog
+* Wed Jun 10 2026 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.4.1-6
+- Apply upstream PR to fix g_realloc / memmove incorrect usage detected with
+ gcc17 -fanalyzer
+
* Fri May 15 2026 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.4.1-5
- Additional fix for GFileInfo warnings with menu/application window
reply other threads:[~2026-06-10 15:18 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=178110472861.1.10838438364060046023.rpms-libfm-79463231e118@fedoraproject.org \
--to=mtasaka@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