Mail Archives: djgpp/1997/09/20/20:48:57
I found a bug in DJGPP's handling of very large response files
(src/libc/crt0/c1args.c). The space for the contents of the response file
was allocated with `alloca', and so any response file larger than the stack
(usually 256K) would cause a stack fault. I have changed it to use `malloc'
instead. A patch is included below.
Anyone with feedback on this, please let me know.
Patch for src/libc/crt0/c1args.c
--cut--
*** oldc1arg.c Sun Sep 1 01:09:32 1996
--- c1args.c Sat Sep 20 17:25:34 1997
***************
*** 245,253 ****
st_size = lseek(f, 0L, SEEK_END);
lseek(f, 0L, SEEK_SET);
! bytes = (char *)alloca(st_size);
len = _read(f, bytes, st_size);
_close(f);
al->argv[i]->arg_file = parse_bytes(bytes, len);
expand_response_files(al->argv[i]->arg_file);
}
}
--- 245,254 ----
st_size = lseek(f, 0L, SEEK_END);
lseek(f, 0L, SEEK_SET);
! bytes = (char *)c1xmalloc(st_size); /* Changed from alloca --NE */
len = _read(f, bytes, st_size);
_close(f);
al->argv[i]->arg_file = parse_bytes(bytes, len);
expand_response_files(al->argv[i]->arg_file);
+ free(bytes);
}
}
--cut--
Nate Eldredge
eldredge AT ap DOT net
- Raw text -