From fd4a538c678e632b5008e787fa7467496205e787 Mon Sep 17 00:00:00 2001 From: Dimitri Schoolwerth Date: Thu, 17 Dec 2020 02:16:30 +0100 Subject: [PATCH] Add iOS compile-time check for inflateValidate Don't use inflateValidate if targeting pre-iOS 11. --- pngrutil.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/pngrutil.c b/pngrutil.c index 81195578e..4fa820c98 100644 --- a/pngrutil.c +++ b/pngrutil.c @@ -27,16 +27,27 @@ * minimal supported OS version. */ - /* For MAC_OS_X_VERSION_MIN_REQUIRED. + /* For TARGET_OS_IPHONE / TARGET_OS_MAC */ +# include + + /* For IPHONE_OS_VERSION_MIN_REQUIRED / 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 +# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE +# if defined(IPHONE_OS_VERSION_MIN_REQUIRED) && \ + IPHONE_OS_VERSION_MIN_REQUIRED < 110000 + /* Don't use if targeting pre-iOS 11.0. */ +# define PNG_USE_ZLIB_INFLATE_VALIDATE 0 +# endif +# elif defined(TARGET_OS_MAC) && TARGET_OS_MAC +# 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 # endif /* __APPLE__ && __MACH__ */ # else