Bug 36641 - rpm -bb segfaults when parameter is passed to macro
rpm -bb segfaults when parameter is passed to macro
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: rpm (Show other bugs)
7.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jeff Johnson
David Lawrence
:
: 41089 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-04-19 09:14 EDT by Toralf
Modified: 2007-04-18 12:32 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-04-19 09:18:40 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
.spec file that provokes crash (651 bytes, text/plain)
2001-04-19 09:15 EDT, Toralf
no flags Details
Core file produced by 'rpm -bb rpmCrash.spec' (360.00 KB, application/octet-stream)
2001-04-19 09:18 EDT, Toralf
no flags Details

  None (edit)
Description Toralf 2001-04-19 09:14:18 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.2.17-14 i686)


After upgrading to rpm-4.0.2-7x from "Red Hat Updates",
'rpm -bb' started dumping core for most of my .spec files.
Further investigation shows that this happens whenever the file
contains a macro expansion with parameters, the most common being
'%setup -n <directory>'. The crash does not occur when a parameterised
macro is expanded without actually passing any parameters.


Reproducible: Always
Steps to Reproduce:
1. rpm -bb rpmCrash.spec

(rpmCrash.spec will be attached to this report) 
	

Actual Results:  Segmentation fault (core dumped)

Expected Results:  
Wrote: /usr/src/redhat/RPMS/i386/ks-provoke-0-1ks.i386.rpm
Comment 1 Toralf 2001-04-19 09:15:27 EDT
Created attachment 15746 [details]
.spec file that provokes crash
Comment 2 Toralf 2001-04-19 09:18:37 EDT
Created attachment 15747 [details]
Core file produced by 'rpm -bb rpmCrash.spec'
Comment 3 Jeff Johnson 2001-04-19 10:42:29 EDT
Yup.

Here's the patch (already fixed on the rpm-4_0 branch in CVS):
Index: macro.c
===================================================================
RCS file: /cvs/devel/rpm/rpmio/macro.c,v
retrieving revision 2.53.2.6
retrieving revision 2.53.2.7
diff -u -r2.53.2.6 -r2.53.2.7
--- macro.c	2001/01/19 01:55:17	2.53.2.6
+++ macro.c	2001/03/23 16:18:12	2.53.2.7
@@ -801,7 +801,7 @@
     /* Build argv array */
     argv = (const char **) alloca((argc + 1) * sizeof(char *));
     be[-1] = ' ';	/*  be - 1 == b + strlen(b) == buf + strlen(buf)  */
-    buf[0] = '\0';
+    be[0] = '\0';
     b = buf;
     for (c = 0; c < argc; c++) {
 	argv[c] = b;
Comment 4 Jeff Johnson 2001-05-20 13:14:42 EDT
*** Bug 41089 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.