Article View: gnu.g++.bug
Article #1762alloca's in ld.c cause seg-faults
From: Othar Hansson
Date: Mon, 20 Mar 1989 04:02
Date: Mon, 20 Mar 1989 04:02
24 lines
1211 bytes
1211 bytes
In "GNU C++ version 1.34.1 (68k, MIT Syntax)
compiled by GNU C version 1.34" on a SUN 3, ...
ld++ exits with a segmentation fault when fed source files with large
data segments. The fault is caused by an attempt to 'alloca' a large
chunk of memory in 'copy_data()' in ld.c
bytes = (char *) alloca (entry->header.a_data);
if a_data is too big (e.g. 950k) to fit on the call stack, then alloca
returns garbage, apparently. Allocating using malloc() (with a
corresponding 'free(bytes)') fixes the problem, but alloca is used in
similarly dangerous contexts elsewhere.
Please don't ask how ugly my program must be
to have a data segment of 950k :-)
Othar Hansson
( othar@cs.ucla.edu
..!{ucbvax|rutgers}!ucla-cs!othar )
Technical Details
Message-ID:
<8903200402.AA26265@maui.cs.ucla.edu>Path:
arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!nih-csl!elsie!cvl!haven!purdue!decwrl!ucbvax!tut.cis.ohio-state.edu!CS.UCLA.EDU!otharShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!nih-csl!elsie!cvl!haven!purdue!decwrl!ucbvax!tut.cis.ohio-state.edu!CS.UCLA.EDU!othar From: othar@CS.UCLA.EDU (Othar Hansson) Newsgroups: gnu.g++.bug Subject: alloca's in ld.c cause seg-faults Message-ID: <8903200402.AA26265@maui.cs.ucla.edu> Date: 20 Mar 89 04:02:45 GMT Sender: daemon@tut.cis.ohio-state.edu Reply-To: othar@cs.ucla.edu Distribution: gnu Organization: Weapons Division, Pepperidge Farm Lines: 24