Bug 36641 - rpm -bb segfaults when parameter is passed to macro
Summary: rpm -bb segfaults when parameter is passed to macro
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm
Version: 7.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact: David Lawrence
URL:
Whiteboard:
: 41089 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-04-19 13:14 UTC by Toralf
Modified: 2007-04-18 16:32 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2001-04-19 13:18:40 UTC
Embargoed:


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

Description Toralf 2001-04-19 13:14:18 UTC
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 13:15:27 UTC
Created attachment 15746 [details]
.spec file that provokes crash

Comment 2 Toralf 2001-04-19 13:18:37 UTC
Created attachment 15747 [details]
Core file produced by 'rpm -bb rpmCrash.spec'

Comment 3 Jeff Johnson 2001-04-19 14:42:29 UTC
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 17:14:42 UTC
*** 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.