Mail Archives: djgpp/1997/07/17/03:40:38
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/
- Raw text -