🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Othar Hansson Mon, 20 Mar 1989 04:02
alloca's in ld.c cause seg-faults
#1762
Author: Othar Hansson
Date: Mon, 20 Mar 1989 04:02
24 lines
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 )
alloca's in ld.c cause seg-faults
#1766
Author: Michael Tiemann
Date: Mon, 20 Mar 1989 17:14
46 lines
1682 bytes
   Date: Sun, 19 Mar 89 20:02:45 PST
   From: othar@cs.ucla.edu (Othar Hansson)
   Reply-To: othar@cs.ucla.edu
   Organization: Weapons Division, Pepperidge Farm
   Physical-Address: 3436 Boelter Hall



   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 )

This problem may be fixable by doing this:

	unlimit stacksize

Or, do this:

	limit

see what the limit of stacksize is (say 2048K), multiply it by 4, and
set a new limit:

	limit stacksize 8192

Michael
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads