diff --git a/CCache/ccache.c b/CCache/ccache.c index c5c510388..a28d38324 100644 --- a/CCache/ccache.c +++ b/CCache/ccache.c @@ -735,13 +735,15 @@ static void from_cache(int first) } /* send the cpp stderr, if applicable */ - fd_cpp_stderr = open(cpp_stderr, O_RDONLY | O_BINARY); - if (fd_cpp_stderr != -1) { - copy_fd(fd_cpp_stderr, 2); - close(fd_cpp_stderr); - unlink(cpp_stderr); - free(cpp_stderr); - cpp_stderr = NULL; + if (cpp_stderr) { + fd_cpp_stderr = open(cpp_stderr, O_RDONLY | O_BINARY); + if (fd_cpp_stderr != -1) { + copy_fd(fd_cpp_stderr, 2); + close(fd_cpp_stderr); + unlink(cpp_stderr); + free(cpp_stderr); + cpp_stderr = NULL; + } } /* send the stderr */ diff --git a/CCache/mdfour.c b/CCache/mdfour.c index b098e0215..5b304852b 100644 --- a/CCache/mdfour.c +++ b/CCache/mdfour.c @@ -88,8 +88,8 @@ static void copy64(uint32 *M, const unsigned char *in) int i; for (i=0;i<16;i++) - M[i] = (in[i*4+3]<<24) | (in[i*4+2]<<16) | - (in[i*4+1]<<8) | (in[i*4+0]<<0); + M[i] = ((uint32)in[i*4+3]<<24) | ((uint32)in[i*4+2]<<16) | + ((uint32)in[i*4+1]<<8) | ((uint32)in[i*4+0]<<0); } static void copy4(unsigned char *out,uint32 x) diff --git a/CHANGES.current b/CHANGES.current index 9de2a3e72..82c6dbee8 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/ Version 4.2.0 (in progress) =========================== +2022-11-26: wsfulton + #2449 Fix undefined behaviour in ccache-swig calculating md4 hashes and possibly + also handling errors when CCACHE_CPP2 is set. + 2022-11-26: wsfulton #1589 #1590 Slightly better decltype() support for expressions, such as: