From:	SMTP%"pierre@ovs.com"  7-NOV-1997 17:02:21.45
To:	ntdev@atria.com
CC:	
Subj:	[ntdev] strange crash on signal call

Return-Path: owner-ntdev@atria.com
Received: by arisia.gce.com (UCX V4.1-12C, OpenVMS V7.1 VAX);
	Fri, 7 Nov 1997 16:46:08 -0500
Received: from gw.atria.com (gw.atria.com [192.88.237.2]) by mercury.mv.net (8.8.8/mem-971025) with SMTP id RAA22952 for <everhart@arisia.gce.com>; Tue, 4 Nov 1997 17:42:02 -0500 (EST)
Received: by gw.atria.com id <LAA27535@gw.atria.com> Tue, 4 Nov 1997 11:13:58 -0500    
Received: from comsoon.login.net by gw.atria.com id <LAA27527@gw.atria.com> Tue, 4 Nov 1997 11:13:54 -0500    
Received: (uucp@localhost) by comsoon.login.net (8.6.12/8.6.5) with UUCP id LAA23273 for ntdev@atria.com; Tue, 4 Nov 1997 11:13:37 -0500
Received: from memo.ovs.com by ovs.com (SMI-8.6/SMI-SVR4)
	id KAA12029; Tue, 4 Nov 1997 10:50:15 -0500
Message-ID: <345F4434.5677@ovs.com>
Date: Tue, 04 Nov 1997 10:50:12 -0500
From: Pierre Duchene <pierre@ovs.com>
X-Mailer: Mozilla 3.0Gold (Win95; I)
MIME-Version: 1.0
To: ntdev@atria.com
CC: pierre@duchene.ovs.com
Subject: [ntdev] strange crash on signal call
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: owner-ntdev@atria.com
Precedence: bulk

Here is a very small program that calls signal(SIGFPE,shandler) and
crashes right on this call (in msvcrt40.dll but it wouldn't crash in the
debug version). The succesion of calls to malloc and free creates a
context which seems to be fatal to signal. Also, the crash does not
happen when the program is started from a DOS prompt or from the
debugger, and seems also to be very sensitive to the location of the
program on the hard drive.

Any idea ???

Thanks.

Pierre.

-----------------------
#include <windows.h>    
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>

volatile double d = 0.0f;

int shandler(int sig)
{
    _fpreset();
}

int WINAPI WinMain(HANDLE hInstance, HANDLE hPrevInstance, LPSTR
lpCmdLine, int nCmdShow)
{
    char **argv;
    long argc;
    char *c1,*c2,*c3;

    MessageBox(NULL,"Starting 1","Error",MB_OK);

argv=calloc(261,4);
c1=malloc(30);
c2=malloc(22);
c3=malloc(16);
free(c2);
free(c3);
free(c1);
malloc(16);
free(argv);

argv=calloc(261,4);
malloc(30);
malloc(22);
malloc(16);
free(argv);
malloc(4);
malloc(12);
calloc(4,16);
calloc(4,20);
calloc(1,8);

    MessageBox(NULL,"Starting 2","Error",MB_OK);
    signal(SIGFPE,shandler);			<=======  CRASH
    MessageBox(NULL,"Starting 3","Error",MB_OK);

    return TRUE; 
}
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[ To unsubscribe, send email to ntdev-request@atria.com with body
UNSUBSCRIBE (the subject is ignored). ]
