Date: Thu, 17 Jul 1997 10:40:04 +0300 (EET DST) From: Esa A E Peuha Reply-To: Esa DOT Peuha AT Helsinki DOT FI To: Eli Zaretskii cc: djgpp AT delorie DOT com Subject: Bug in `putenv'/`crt1'? (was Re: Emacs 22 env vars bug) In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Tue, 15 Jul 1997, Esa A E Peuha wrote: > It's possible that `regex_compile' calls `realloc' with invalid pointer; > if so, the fault is an uninitialized pointer in `search.c'. I'll change > `_free_internal' to recognize this, and will post the patch for testing. After all, there's probably nothing wrong with `search.c'. Here's a patch that will cause `_free_internal' to crash if it is called with invalid pointer (useful for debugging, but normally this should probably just return): *** src\gmalloc.c Tue Aug 13 01:12:20 1996 --- newsrc\gmalloc.c Tue Jul 15 15:18:22 1997 *************** *** 907,919 **** --- 907,924 ---- if (ptr == NULL) return; + curbrk = NULL; for (l = _aligned_blocks; l != NULL; l = l->next) if (l->aligned == ptr) { l->aligned = NULL; /* Mark the slot in the list as free. */ ptr = l->exact; + curbrk = ptr; break; } + + if (curbrk == NULL) + ptr = *(__ptr_t *) curbrk; /* Crash if invalid pointer. */ block = BLOCK (ptr); ----- end of patch ----- With this patch, even my emacs.exe will crash, and the traceback points to `putenv'. Is this a bug in `putenv.c' or `crt1.c' or both, or is it something specific to Emacs? Esa Peuha student of mathematics at the University of Helsinki http://www.helsinki.fi/~peuha/