From 759dc457a8c4188b9ba4fb07386d5067a493e996 Mon Sep 17 00:00:00 2001 From: Dimitri Schoolwerth Date: Thu, 17 Dec 2020 01:49:19 +0100 Subject: [PATCH] Fix continued undesired usage of inflateValidate Macro MAC_OS_X_VERSION_MIN_REQUIRED isn't present through, coincidental, inclusion of , which means inflateValidate can still be used resulting in a warning when targeting pre-10.13 and a crash if called pre-10.13 as described in (attempted fix) bda2970c65. Fix by including the needed header explicitly. --- pngrutil.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/pngrutil.c b/pngrutil.c index aad1cc42a..81195578e 100644 --- a/pngrutil.c +++ b/pngrutil.c @@ -22,14 +22,23 @@ /* Check if zlib's inflateValidate can be used. */ # if ZLIB_VERNUM >= 0x1290 && \ defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_IGNORE_ADLER32) - /* Determine at compile-time whether inflateValidate is available by - * minimal supported OS version. - */ -# if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \ - MAC_OS_X_VERSION_MIN_REQUIRED < 101300 - /* Don't use if targeting pre-macOS 10.13. */ -# define PNG_USE_ZLIB_INFLATE_VALIDATE 0 -# endif +# if defined(__APPLE__) && defined(__MACH__) + /* Determine at compile-time whether inflateValidate is available by + * minimal supported OS version. + */ + + /* For MAC_OS_X_VERSION_MIN_REQUIRED. + * Not using the preferred because it was introduced + * during the 10.5 SDK while this header has been available with Xcode + * since 1.0 (10.3 SDK). + */ +# include +# if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \ + MAC_OS_X_VERSION_MIN_REQUIRED < 101300 + /* Don't use if targeting pre-macOS 10.13. */ +# define PNG_USE_ZLIB_INFLATE_VALIDATE 0 +# endif +# endif /* __APPLE__ && __MACH__ */ # else # define PNG_USE_ZLIB_INFLATE_VALIDATE 0 # endif /* ZLIB_VERNUM && PNG_SET_OPTION_SUPPORTED && PNG_IGNORE_ADLER32 */