1 |
commit: a8c8e0a371b8b48481ff8d79c0841e20a8ce78d8 |
2 |
Author: Marek Szuba <marecki <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Jul 30 12:16:59 2021 +0000 |
4 |
Commit: Marek Szuba <marecki <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Jul 30 12:20:58 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a8c8e0a3 |
7 |
|
8 |
sys-apps/util-linux-2.37.1: fix lscpu segfault on some arches |
9 |
|
10 |
Observed on rv64 but could in princple happen elsewhere too. |
11 |
|
12 |
Bug: https://bugs.gentoo.org/802606 |
13 |
Signed-off-by: Marek Szuba <marecki <AT> gentoo.org> |
14 |
|
15 |
.../files/util-linux-2.37.1-lscpu_nullptr.patch | 26 ++++++++++++++++++++++ |
16 |
sys-apps/util-linux/util-linux-2.37.1.ebuild | 4 ++++ |
17 |
2 files changed, 30 insertions(+) |
18 |
|
19 |
diff --git a/sys-apps/util-linux/files/util-linux-2.37.1-lscpu_nullptr.patch b/sys-apps/util-linux/files/util-linux-2.37.1-lscpu_nullptr.patch |
20 |
new file mode 100644 |
21 |
index 00000000000..bfb528cf1f1 |
22 |
--- /dev/null |
23 |
+++ b/sys-apps/util-linux/files/util-linux-2.37.1-lscpu_nullptr.patch |
24 |
@@ -0,0 +1,26 @@ |
25 |
+If you call a function which can return a null pointer you probably want |
26 |
+to check the return value before attempting to dereference it. </sarcasm> |
27 |
+ |
28 |
+--- a/sys-utils/lscpu.c |
29 |
++++ b/sys-utils/lscpu.c |
30 |
+@@ -966,7 +966,7 @@ |
31 |
+ *(p - 2) = '\0'; |
32 |
+ add_summary_s(tb, sec, _("CPU op-mode(s):"), buf); |
33 |
+ } |
34 |
+- if (ct->addrsz) |
35 |
++ if (ct && ct->addrsz) |
36 |
+ add_summary_s(tb, sec, _("Address sizes:"), ct->addrsz); |
37 |
+ #if !defined(WORDS_BIGENDIAN) |
38 |
+ add_summary_s(tb, sec, _("Byte Order:"), "Little Endian"); |
39 |
+@@ -1008,9 +1008,9 @@ |
40 |
+ sec = NULL; |
41 |
+ |
42 |
+ /* Section: cpu type description */ |
43 |
+- if (ct->vendor) |
44 |
++ if (ct && ct->vendor) |
45 |
+ sec = add_summary_s(tb, NULL, _("Vendor ID:"), ct->vendor); |
46 |
+- if (ct->bios_vendor) |
47 |
++ if (ct && ct->bios_vendor) |
48 |
+ add_summary_s(tb, sec, _("BIOS Vendor ID:"), ct->bios_vendor); |
49 |
+ |
50 |
+ for (i = 0; i < cxt->ncputypes; i++) |
51 |
|
52 |
diff --git a/sys-apps/util-linux/util-linux-2.37.1.ebuild b/sys-apps/util-linux/util-linux-2.37.1.ebuild |
53 |
index 141bdf409cb..c12359853f4 100644 |
54 |
--- a/sys-apps/util-linux/util-linux-2.37.1.ebuild |
55 |
+++ b/sys-apps/util-linux/util-linux-2.37.1.ebuild |
56 |
@@ -86,6 +86,10 @@ RESTRICT="!test? ( test )" |
57 |
|
58 |
S="${WORKDIR}/${MY_P}" |
59 |
|
60 |
+PATCHES=( |
61 |
+ "${FILESDIR}"/${PN}-2.37.1-lscpu_nullptr.patch |
62 |
+) |
63 |
+ |
64 |
src_prepare() { |
65 |
default |