diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ffae8f8e..6018f317 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -149,7 +149,8 @@ jobs: mkdir build pushd build cmake -G"Unix Makefiles" -DWITH_JPEG8=1 \ - -DCMAKE_C_FLAGS='--std=gnu90 -Wall -Werror -Wextra -Wpedantic -pedantic-errors -Wdouble-promotion -Wformat-overflow=2 -Wformat-security -Wformat-signedness -Wformat-truncation=2 -Wformat-y2k -Wmissing-include-dirs -Wshift-overflow=2 -Wswitch-bool -Wno-unused-parameter -Wuninitialized -Wstrict-overflow=2 -Wstringop-overflow=4 -Wstringop-truncation -Wduplicated-branches -Wduplicated-cond -Wdeclaration-after-statement -Wshadow -Wunsafe-loop-optimizations -Wundef -Wcast-align -Wno-clobbered -Wjump-misses-init -Wno-sign-compare -Wlogical-op -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wpacked -Wredundant-decls -Wnested-externs -Winline -Wno-long-long -Wdisabled-optimization -Wno-overlength-strings -fcf-protection' \ + -DCMAKE_C_FLAGS='--std=gnu90 -Wall -Werror -Wextra -Wmost -Wnon-gcc -Wpedantic -pedantic-errors -Walloca -Wanon-enum-enum-conversion -Warray-bounds-pointer-arithmetic -Wbitfield-enum-conversion -Wc99-extensions -Wc2x-extensions -Wcast-function-type -Wcompound-token-split -Wdate-time -Wdeclaration-after-statement -Wdeprecated -Wdocumentation -Wdocumentation-pedantic -Wdouble-promotion -Wduplicate-decl-specifier -Wduplicate-enum -Wempty-init-stmt -Wexpansion-to-defined -Wextra-semi -Wformat=2 -Wformat-non-iso -Wno-format-nonliteral -Wformat-pedantic -Wformat-type-confusion -Wfour-char-constants -Wgcc-compat -Wgnu -Wheader-hygiene -Widiomatic-parentheses -Wignored-qualifiers -Wimplicit-fallthrough -Wno-implicit-int-conversion -Wincompatible-function-pointer-types -Wno-long-long -Wloop-analysis -Wmain -Wmax-tokens -Wmisleading-indentation -Wmissing-field-initializers -Wmissing-prototypes -Wmissing-variable-declarations -Wnewline-eof -Wnonportable-system-include-path -Wnullable-to-nonnull-conversion -Wold-style-cast -Wover-aligned -Wparentheses -Wpointer-arith -Wpragmas -Wpre-c2x-compat -Wredundant-parens -Wself-assign -Wshadow-all -Wshift-sign-overflow -Wno-shorten-64-to-32 -Wno-sign-conversion -Wsometimes-uninitialized -Wstatic-in-inline -Wstrict-prototypes -Wswitch-default -Wtautological-constant-in-range-compare -Wthread-safety -Wthread-safety-verbose -Wunaligned-access -Wundef -Wundef-prefix -Wundefined-func-template -Wuninitialized -Wunneeded-internal-declaration -Wunreachable-code-fallthrough -Wno-unused-command-line-argument -Wunused-member-function -Wno-unused-parameter -Wvariadic-macros -Wzero-as-null-pointer-constant -Wzero-length-array -fcf-protection' \ + -DCMAKE_C_COMPILER=clang-14 \ .. export NUMCPUS=`grep -c '^processor' /proc/cpuinfo` make -j$NUMCPUS --load-average=$NUMCPUS diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f6bbdd0..e6fc9323 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -481,7 +481,7 @@ if(UNIX) return 1; /* right shift is signed */ /* see if unsigned-shift hack will fix it. */ /* we can't just test exact value since it depends on width of long... */ - res |= (~0L) << (32-4); + res |= 0xFFFFFFFFL << (32-4); if (res == -0x7F7E80CL) return 0; /* right shift is unsigned */ printf(\"Right shift isn't acting as I expect it to.\\\\n\"); diff --git a/cjpeg.c b/cjpeg.c index b7385bff..44c39bec 100644 --- a/cjpeg.c +++ b/cjpeg.c @@ -361,7 +361,8 @@ parse_switches(j_compress_ptr cinfo, int argc, char **argv, if (!printed_version) { fprintf(stderr, "%s version %s (build %s)\n", PACKAGE_NAME, VERSION, BUILD); - fprintf(stderr, "%s\n\n", JCOPYRIGHT); + fprintf(stderr, JCOPYRIGHT1); + fprintf(stderr, JCOPYRIGHT2 "\n"); fprintf(stderr, "Emulating The Independent JPEG Group's software, version %s\n\n", JVERSION); printed_version = TRUE; diff --git a/djpeg.c b/djpeg.c index fd30a9ed..1baeddde 100644 --- a/djpeg.c +++ b/djpeg.c @@ -267,7 +267,8 @@ parse_switches(j_decompress_ptr cinfo, int argc, char **argv, if (!printed_version) { fprintf(stderr, "%s version %s (build %s)\n", PACKAGE_NAME, VERSION, BUILD); - fprintf(stderr, "%s\n\n", JCOPYRIGHT); + fprintf(stderr, JCOPYRIGHT1); + fprintf(stderr, JCOPYRIGHT2 "\n"); fprintf(stderr, "Emulating The Independent JPEG Group's software, version %s\n\n", JVERSION); printed_version = TRUE; diff --git a/jpegtran.c b/jpegtran.c index 2857a564..407cc438 100644 --- a/jpegtran.c +++ b/jpegtran.c @@ -241,7 +241,8 @@ parse_switches(j_compress_ptr cinfo, int argc, char **argv, if (!printed_version) { fprintf(stderr, "%s version %s (build %s)\n", PACKAGE_NAME, VERSION, BUILD); - fprintf(stderr, "%s\n\n", JCOPYRIGHT); + fprintf(stderr, JCOPYRIGHT1); + fprintf(stderr, JCOPYRIGHT2 "\n"); fprintf(stderr, "Emulating The Independent JPEG Group's software, version %s\n\n", JVERSION); printed_version = TRUE; diff --git a/jversion.h.in b/jversion.h.in index 0f68fe63..fc0ce3e0 100644 --- a/jversion.h.in +++ b/jversion.h.in @@ -36,20 +36,21 @@ * their code */ -#define JCOPYRIGHT \ +#define JCOPYRIGHT1 \ "Copyright (C) 2009-2024 D. R. Commander\n" \ "Copyright (C) 2015, 2020 Google, Inc.\n" \ "Copyright (C) 2019-2020 Arm Limited\n" \ "Copyright (C) 2015-2016, 2018 Matthieu Darbois\n" \ "Copyright (C) 2011-2016 Siarhei Siamashka\n" \ - "Copyright (C) 2015 Intel Corporation\n" \ + "Copyright (C) 2015 Intel Corporation\n" +#define JCOPYRIGHT2 \ "Copyright (C) 2013-2014 Linaro Limited\n" \ "Copyright (C) 2013-2014 MIPS Technologies, Inc.\n" \ "Copyright (C) 2009, 2012 Pierre Ossman for Cendio AB\n" \ "Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)\n" \ "Copyright (C) 1999-2006 MIYASAKA Masaru\n" \ "Copyright (C) 1999 Ken Murchison\n" \ - "Copyright (C) 1991-2020 Thomas G. Lane, Guido Vollbeding" + "Copyright (C) 1991-2020 Thomas G. Lane, Guido Vollbeding\n" #define JCOPYRIGHT_SHORT \ "Copyright (C) @COPYRIGHT_YEAR@ The libjpeg-turbo Project and many others" diff --git a/md5/md5hl.c b/md5/md5hl.c index 849a1366..81200935 100644 --- a/md5/md5hl.c +++ b/md5/md5hl.c @@ -6,7 +6,8 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * libjpeg-turbo Modifications: - * Copyright (C)2016, 2018-2019, 2022 D. R. Commander. All Rights Reserved. + * Copyright (C)2016, 2018-2019, 2022, 2024 D. R. Commander. + * All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -111,7 +112,7 @@ char *MD5FileChunk(const char *filename, char *buf, off_t ofs, off_t len) n = len; i = 0; while (n > 0) { - if (n > sizeof(buffer)) + if ((size_t)n > sizeof(buffer)) i = read(f, buffer, sizeof(buffer)); else i = read(f, buffer, n); diff --git a/turbojpeg-mp.c b/turbojpeg-mp.c index 5090bf48..d4b3c74c 100644 --- a/turbojpeg-mp.c +++ b/turbojpeg-mp.c @@ -180,7 +180,8 @@ DLLEXPORT int GET_NAME(tj3Decompress, BITS_IN_JSAMPLE) } setDecompParameters(this); if (this->maxPixels && - (unsigned long long)this->jpegWidth * this->jpegHeight > this->maxPixels) + (unsigned long long)this->jpegWidth * this->jpegHeight > + (unsigned long long)this->maxPixels) THROW("Image is too large"); this->dinfo.out_color_space = pf2cs[pixelFormat]; #if BITS_IN_JSAMPLE != 16 diff --git a/turbojpeg.c b/turbojpeg.c index c377d59f..3c936160 100644 --- a/turbojpeg.c +++ b/turbojpeg.c @@ -2361,7 +2361,8 @@ DLLEXPORT int tj3DecompressToYUVPlanes8(tjhandle handle, } setDecompParameters(this); if (this->maxPixels && - (unsigned long long)this->jpegWidth * this->jpegHeight > this->maxPixels) + (unsigned long long)this->jpegWidth * this->jpegHeight > + (unsigned long long)this->maxPixels) THROW("Image is too large"); if (this->subsamp == TJSAMP_UNKNOWN) THROW("Could not determine subsampling level of JPEG image"); @@ -2730,7 +2731,7 @@ DLLEXPORT int tj3Transform(tjhandle handle, const unsigned char *jpegBuf, jpeg_read_header(dinfo, TRUE); if (this->maxPixels && (unsigned long long)dinfo->image_width * dinfo->image_height > - this->maxPixels) + (unsigned long long)this->maxPixels) THROW("Image is too large"); this->subsamp = getSubsamp(&this->dinfo);