RFR: 8296812: sprintf is deprecated in Xcode 14 [v18]

Xue-Lei Andrew Fan xuelei at openjdk.org
Thu Dec 8 03:23:04 UTC 2022


On Wed, 7 Dec 2022 21:25:11 GMT, Xue-Lei Andrew Fan <xuelei at openjdk.org> wrote:

>> Hi,
>> 
>> May I have this update reviewed?
>> 
>> The sprintf is deprecated in Xcode 14 because of security concerns, and the use of it causing building failure.  The build could pass if warnings are disabled for codes that use sprintf method.  For the long run, the sprintf could be replaced with snprintf.  This patch is trying to check if snprintf could be used.
>> 
>> Thanks,
>> Xuelei
>
> Xue-Lei Andrew Fan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   update on review feedback

> With the exception of these errors in cmstypes.c
> 
> /Users/mjh/Documents/GitHub/jdk/src/java.desktop/share/native/liblcms/cmstypes.c:3441:132: error: parameter 'SizeOfTag' set but not used [-Werror,-Wunused-but-set-parameter] void *Type_ProfileSequenceId_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsUInt32Number* nItems, cmsUInt32Number SizeOfTag) ^ /Users/mjh/Documents/GitHub/jdk/src/java.desktop/share/native/liblcms/cmstypes.c:5137:125: error: parameter 'SizeOfTag' set but not used [-Werror,-Wunused-but-set-parameter] void *Type_Dictionary_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsUInt32Number* nItems, cmsUInt32Number SizeOfTag) ^ 2 errors generated.
> 
> I had seen this sometime back. The same workaround of adding?
> 
> cmsUNUSED_PARAMETER(SizeOfTag); // mjh
> 
> To the two methods, which I had noticed included elsewhere in the code, still appears to work.
> 

The SizeOfTag issue was tracked with https://bugs.openjdk.org/browse/JDK-8283221.

> I first noticed the sprintf issue in later releases of Xcode 13. It isn?t just Xcode 14.
> 

In the [Apple Developer Documentation](https://developer.apple.com/documentation/kernel/1441083-sprintf), there is a note for sprintf, "macOS 10.12–10.13.1 Deprecated".  It looks like that deprecation was backported.

-------------

PR: https://git.openjdk.org/jdk/pull/11115



More information about the client-libs-dev mailing list