RFR: 8296812: sprintf is deprecated in Xcode 14

Xue-Lei Andrew Fan xuelei at openjdk.org
Mon Nov 21 06:18:13 UTC 2022


On Sun, 13 Nov 2022 20:48:04 GMT, Kim Barrett <kbarrett 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
>
> Please don't add uses of `jio_snprintf` or `::snprintf` to hotspot. Use `os::snprintf`.
> 
> Regarding `jio_snprintf`, see https://bugs.openjdk.org/browse/JDK-8198918.
> Regarding `os::snprintf` and `os::vsnprintf`, see https://bugs.openjdk.org/browse/JDK-8285506.
> 
> I think the only reason we haven't marked `::sprintf` and `::snprintf` forbidden
> (FORBID_C_FUNCTION) is there are a lot of uses, and nobody has gotten around
> to dealing with it.  `::snprintf` in the list of candidates for
> https://bugs.openjdk.org/browse/JDK-8214976, some of which have already been
> marked.  But I don't see new bugs for the as-yet unmarked ones.
> 
> As a general note, as a reviewer my preference is against non-trivial and
> persnickety code changes that are scattered all over the code base. For
> something like this I'd prefer multiple more bite-sized changes that were
> dealing with specific uses.  I doubt everyone agrees with me though.

@kimbarrett, did you have further comments?  I'm going to integrate this update this week.  Please let me know if you need more time.  Thanks!

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

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



More information about the client-libs-dev mailing list