mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 15:28:30 +00:00
Improve alloca() memory safety
Now that all the bugs have been wormed out of the ASAN memory module we can successfully check for underruns on large stack allocations.
This commit is contained in:
parent
1ff1854107
commit
38cb6e71ca
4 changed files with 10 additions and 13 deletions
12
third_party/quickjs/qjsc.c
vendored
12
third_party/quickjs/qjsc.c
vendored
|
@ -26,6 +26,7 @@
|
|||
#include "libc/fmt/fmt.h"
|
||||
#include "libc/log/log.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/x/x.h"
|
||||
|
@ -476,7 +477,7 @@ int main(int argc, char **argv)
|
|||
{
|
||||
int c, i, verbose;
|
||||
const char *out_filename, *cname;
|
||||
char cfilename[1024];
|
||||
char *cfilename = gc(malloc(1024));
|
||||
FILE *fo;
|
||||
JSRuntime *rt;
|
||||
JSContext *ctx;
|
||||
|
@ -603,14 +604,9 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
if (output_type == OUTPUT_EXECUTABLE) {
|
||||
#if defined(_WIN32) || defined(__ANDROID__)
|
||||
/* XXX: find a /tmp directory ? */
|
||||
snprintf(cfilename, sizeof(cfilename), "out%d.c", getpid());
|
||||
#else
|
||||
snprintf(cfilename, sizeof(cfilename), "/tmp/out%d.c", getpid());
|
||||
#endif
|
||||
snprintf(cfilename, 1024, "/tmp/out%d.c", getpid());
|
||||
} else {
|
||||
pstrcpy(cfilename, sizeof(cfilename), out_filename);
|
||||
pstrcpy(cfilename, 1024, out_filename);
|
||||
}
|
||||
fo = fopen(cfilename, "w");
|
||||
if (!fo) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue