Carl Shapiro pushed to branch master at cmucl / cmucl
Commits:
557dd71f by Carl Shapiro at 2024-04-28T14:41:49-07:00
Return an error if a copy of *CMUCL-LIB* cannot be allocated
Previously, the malloc and strdup calls were assumed to succeed. Now,
their return values are checked for an error signal. Consistent with
other failures in this file, a value of -1 is returned.
- - - - -
b2fb3f8d by Carl Shapiro at 2024-04-29T01:02:35+00:00
Merge branch 'elf-c-unchecked-malloc' into 'master'
Return an error if a copy of *CMUCL-LIB* cannot be allocated
See merge request cmucl/cmucl!217
- - - - -
1 changed file:
- src/lisp/elf.c
Changes:
=====================================
src/lisp/elf.c
=====================================
@@ -333,13 +333,20 @@ obj_run_linker(long init_func_address, char *file)
extern int debug_lisp_search;
#ifndef UNICODE
paths = strdup((char *)vec->data);
+ if (paths == NULL) {
+ perror("strdup");
+ return -1;
+ }
#else
/*
* What should we do here with 16-bit characters? For now we just
* take the low 8-bits.
*/
paths = malloc(vec->length);
- {
+ if (paths == NULL) {
+ perror("malloc");
+ return -1;
+ } else {
int k;
unsigned short *data;
data = (unsigned short*) vec->data;
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/5b3f4145422d2c70ca7a71…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/5b3f4145422d2c70ca7a71…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch issue-306-lisp.c at cmucl / cmucl
Commits:
7fe88dcd by Raymond Toy at 2024-04-28T12:40:22-07:00
check_ptr takes const ptr and add more uses of it
`check_ptr` takes a `const void* ptr` since it doesn't modify
anything.
Add more uses of `check_ptr` to verify that `strdup` and `malloc`
returned a non-NULL pointer.
- - - - -
1 changed file:
- src/lisp/lisp.c
Changes:
=====================================
src/lisp/lisp.c
=====================================
@@ -45,7 +45,7 @@
static void
-check_ptr(void* ptr, const char* msg)
+check_ptr(const void* ptr, const char* msg)
{
if (ptr == NULL) {
perror(msg);
@@ -276,6 +276,8 @@ default_cmucllib(const char *argv0arg)
/* Create the colon separated list of directories */
defpath = malloc(total_len + 1);
+ check_ptr(defpath, "No space for cmucllib path");
+
*defpath = '\0';
ptr = cmucllib_search_list;
@@ -395,6 +397,8 @@ prepend_core_path(const char *lib, const char *corefile)
}
result = malloc(strlen(path) + strlen(lib) + 2);
+ check_ptr(result, "No space final core path");
+
strcpy(result, path);
strcat(result, ":");
strcat(result, lib);
@@ -748,12 +752,14 @@ main(int argc, const char *argv[], const char *envp[])
*/
if (lib != NULL) {
cmucllib = strdup(lib);
+ check_ptr(cmucllib, "No space for strdup(lib)");
} else {
char *libvar;
libvar = getenv("CMUCLLIB");
if (libvar != NULL) {
cmucllib = strdup(libvar);
+ check_ptr(cmucllib, "No space for strdup(libvar)");
} else {
/*
* The following doesn't make sense for executables. They
@@ -784,7 +790,6 @@ main(int argc, const char *argv[], const char *envp[])
}
}
-
/* Only look for a core file if we're not using a built-in image. */
if (builtin_image_flag == 0) {
/*
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/7fe88dcd1cf24150a385c12…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/7fe88dcd1cf24150a385c12…
You're receiving this email because of your account on gitlab.common-lisp.net.
Carl Shapiro pushed to branch master at cmucl / cmucl
Commits:
af5a360e by Carl Shapiro at 2024-04-26T19:03:44-07:00
Remove the definition of __NO_CTYPE from the Linux build
The definition of this macro disables the definition of isalpha(3) and
other symbols from ctype.h from being defined as macros that depend on
internal glibc functions not present in all versions of glibc.
At the time, that allowed binaries compiled against newer versions of
glibc to run on systems with older versions of glibc. However, today
the internal functions have been available for more than two decades
and so this feature does not appreciably affect compatibility.
- - - - -
5b3f4145 by Carl Shapiro at 2024-04-28T05:24:36+00:00
Merge branch 'no-ctype' into 'master'
Remove the definition of __NO_CTYPE from the Linux build
See merge request cmucl/cmucl!214
- - - - -
1 changed file:
- src/lisp/Config.x86_linux
Changes:
=====================================
src/lisp/Config.x86_linux
=====================================
@@ -2,7 +2,7 @@
include Config.x86_common
CFLAGS += $(COPT)
-CPPFLAGS += -m32 -D__NO_CTYPE
+CPPFLAGS += -m32
CFLAGS += -rdynamic -march=pentium4 -mfpmath=sse -mtune=generic
CFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/520213dd9aa1154c1b9127…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/520213dd9aa1154c1b9127…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch issue-307-dynamically-alloc-altstack at cmucl / cmucl
Commits:
1acd68dc by Raymond Toy at 2024-04-26T20:54:36-07:00
Initialize altstack on Darwin too
Make CI happy by initializing altstack on darwin too.
- - - - -
1 changed file:
- src/lisp/Darwin-os.c
Changes:
=====================================
src/lisp/Darwin-os.c
=====================================
@@ -107,10 +107,13 @@ os_init0(const char *argv[], const char *envp[])
void
os_init(const char *argv[], const char *envp[])
{
+ extern char *altstack;
os_vm_page_size = OS_VM_DEFAULT_PAGESIZE;
#ifdef __ppc__
timebase_init();
#endif
+
+ altstack = malloc(SIGNAL_STACK_SIZE);
}
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/1acd68dcf71f04039cbf82b…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/1acd68dcf71f04039cbf82b…
You're receiving this email because of your account on gitlab.common-lisp.net.
Carl Shapiro pushed to branch master at cmucl / cmucl
Commits:
06958230 by Carl Shapiro at 2024-04-25T12:45:59-07:00
Fix the retry limit for resizing password entry buffer
The previous version checked that the buffer had not exceeded the
limit of 1MiB after the buffer was resized. In otherwords, the buffer
is allowed to grow past the limit before the retry loop is exited.
This change moves the check of the buffer size before the allocation
occurs. Now, the retry loop is exited before the buffer would grow
past the limit.
- - - - -
520213dd by Carl Shapiro at 2024-04-26T02:00:30+00:00
Merge branch 'retry-limit' into 'master'
Fix the retry limit for resizing password entry buffer
See merge request cmucl/cmucl!212
- - - - -
1 changed file:
- src/lisp/os-common.c
Changes:
=====================================
src/lisp/os-common.c
=====================================
@@ -753,26 +753,27 @@ os_file_author(const char *path)
* Keep trying with larger buffers until a maximum is reached. We
* assume (1 << 20) is large enough for any OS.
*/
- while (size <= (1 << 20)) {
- switch (getpwuid_r(sb.st_uid, &pwd, buffer, size, &ppwd)) {
- case 0:
- /* Success, though we might not have a matching entry */
- result = (ppwd == NULL) ? NULL : strdup(pwd.pw_name);
- goto exit;
- case ERANGE:
- /* Buffer is too small, double its size and try again */
- size *= 2;
- if ((buffer = realloc(obuffer, size)) == NULL) {
- goto exit;
- }
- obuffer = buffer;
- continue;
- default:
- /* All other errors */
- goto exit;
- }
+again:
+ switch (getpwuid_r(sb.st_uid, &pwd, buffer, size, &ppwd)) {
+ case 0:
+ /* Success, though we might not have a matching entry */
+ result = (ppwd == NULL) ? NULL : strdup(pwd.pw_name);
+ break;
+ case ERANGE:
+ /* Buffer is too small, double its size and try again */
+ size *= 2;
+ if (size > (1 << 20)) {
+ break;
+ }
+ if ((buffer = realloc(obuffer, size)) == NULL) {
+ break;
+ }
+ obuffer = buffer;
+ goto again;
+ default:
+ /* All other errors */
+ break;
}
-exit:
free(obuffer);
return result;
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/99abb703b68b67143b6a77…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/99abb703b68b67143b6a77…
You're receiving this email because of your account on gitlab.common-lisp.net.
Carl Shapiro pushed to branch master at cmucl / cmucl
Commits:
57c9f9b7 by Carl Shapiro at 2024-04-25T12:30:13-07:00
Fix an incorrect error check detected by the GCC analyzer
The return value of open(2) should be compared with -1 to check for an
error but it was compared with 0 instead.
- - - - -
99abb703 by Carl Shapiro at 2024-04-26T01:53:53+00:00
Merge branch 'open-error' into 'master'
Fix an incorrect error check detected by the GCC analyzer
See merge request cmucl/cmucl!211
- - - - -
1 changed file:
- src/lisp/elf.c
Changes:
=====================================
src/lisp/elf.c
=====================================
@@ -442,7 +442,7 @@ map_core_sections(const char *exec_name)
image_static_space_size,
image_read_only_space_size;
- if (!(exec_fd = open(exec_name, O_RDONLY))) {
+ if ((exec_fd = open(exec_name, O_RDONLY)) == -1) {
perror("Can't open executable!");
exit(-1);
}
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/7c91087e17dd1145e04843…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/7c91087e17dd1145e04843…
You're receiving this email because of your account on gitlab.common-lisp.net.