delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/11/21/19:30:07

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <20031122002949.29224.qmail@web41402.mail.yahoo.com>
Date: Fri, 21 Nov 2003 16:29:49 -0800 (PST)
From: Lloyd Lewins <lloydlewins AT yahoo DOT com>
Subject: Re: 1.5.5: SEGV in calloc before start of main
To: cygwin AT cygwin DOT com
MIME-Version: 1.0

Well I figured out the problem. The application
defines its own heap management routines (malloc,
free, realloc). However it does NOT define calloc. The
existance of an application defined malloc causes
malloc_wrappers to vector dll calloc calls to the
application. However, since the application doesn't
define calloc, the stub immediately calls the wrapper
version again. An infinite recursion results, ensuing
in a segv. I suggest that the wrappers would be more
robust if they checked for the existance of all the
routines they plan to call (including free) -- and at
least generated a helpful error message (this was a
pain for a non-cygwin expert to debug!)

I am a little uncomfortable with the idea that the
startup code makes calls into the application (malloc
etc) before the application is fully initialized (and
before it has a chance to initialize itself in main).
However, I guess that is one of the hazards of writing
your own "system calls" (malloc etc).

Lloyd Lewins

__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019