fix segfault in eu-ar -m

This commit is contained in:
zhangruifang2020 2022-06-27 16:23:14 +08:00
parent 1b13067cc7
commit 31d16e5da2
2 changed files with 39 additions and 1 deletions

View File

@ -0,0 +1,34 @@
From 7170b990d3dc3974b8e670b3c0e4ca6dcc20c853 Mon Sep 17 00:00:00 2001
From: xiezhipeng <xiezhipeng1@huawei.com>
Date: Wed, 8 Dec 2021 09:47:36 +0800
Subject: [PATCH] fix segfault in eu-ar -m
Fix segfaultineu-ar-m.
---
src/ar.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/ar.c b/src/ar.c
index ab6098f..ed5fe2f 100644
--- a/src/ar.c
+++ b/src/ar.c
@@ -1159,6 +1159,7 @@ do_oper_insert (int oper, const char *arfname, char **argv, int argc,
goto next;
struct armem *newp = alloca (sizeof (struct armem));
+ memset (newp, '\0', sizeof(struct armem));
newp->old_off = elf_getaroff (subelf);
newp->size = arhdr->ar_size;
newp->sec = arhdr->ar_date;
@@ -1251,6 +1252,7 @@ do_oper_insert (int oper, const char *arfname, char **argv, int argc,
if (found[cnt] == NULL)
{
found[cnt] = alloca (sizeof (struct armem));
+ memset (found[cnt], '\0', sizeof(struct armem));
found[cnt]->old_off = -1;
remember_long_name (found[cnt], bname, bnamelen);
--
2.27.0

View File

@ -1,13 +1,14 @@
# -*- rpm-spec from http://elfutils.org/ -*- # -*- rpm-spec from http://elfutils.org/ -*-
Name: elfutils Name: elfutils
Version: 0.185 Version: 0.185
Release: 4 Release: 5
Summary: A collection of utilities and DSOs to handle ELF files and DWARF data Summary: A collection of utilities and DSOs to handle ELF files and DWARF data
URL: http://elfutils.org/ URL: http://elfutils.org/
License: GPLv3+ and (GPLv2+ or LGPLv3+) License: GPLv3+ and (GPLv2+ or LGPLv3+)
Source: ftp://sourceware.org/pub/elfutils/%{version}/elfutils-%{version}.tar.bz2 Source: ftp://sourceware.org/pub/elfutils/%{version}/elfutils-%{version}.tar.bz2
Patch0: eu-elfclassify-no-stdin-should-use-classify_flag_no_stdin.patch Patch0: eu-elfclassify-no-stdin-should-use-classify_flag_no_stdin.patch
Patch1: Fix-segfault-in-eu-ar-m.patch
Requires: elfutils-libelf = %{version}-%{release} Requires: elfutils-libelf = %{version}-%{release}
Requires: elfutils-libs = %{version}-%{release} Requires: elfutils-libs = %{version}-%{release}
@ -301,6 +302,9 @@ exit 0
%systemd_postun_with_restart debuginfod.service %systemd_postun_with_restart debuginfod.service
%changelog %changelog
* Mon Jun 27 2022 zhangruifang <zhangruifang1@h-partners.com> - 0.185-5
- fix segfault in eu-ar -m
* Thu Feb 17 2022 panxiaohe <panxh.life@foxmail.com> - 0.185-4 * Thu Feb 17 2022 panxiaohe <panxh.life@foxmail.com> - 0.185-4
- fix wrong use of stdin for eu-elfclassify --no-stdin option - fix wrong use of stdin for eu-elfclassify --no-stdin option