On Wed, 11 Jan 2023 06:26:18 GMT, Xue-Lei Andrew Fan <xue...@openjdk.org> wrote:

> The sprintf is deprecated in Xcode 14 because of security concerns. The issue 
> was addressed in [JDK-8296812](https://bugs.openjdk.org/browse/JDK-8296812) 
> for hotspot impl, and 
> [JDK-8299378](https://bugs.openjdk.org/browse/JDK-8299378) for building, but 
> the test case was not covered. The failure was reported in [PR 
> 11793](https://github.com/openjdk/jdk/pull/11793#issuecomment-1371151565), 
> while running tier1 testing.
> 
> This patch is trying to find the use of sprintf in test cases, and replace it 
> with snprintf accordingly.

This PR does not address all the remaining sprintf:s in hotspot, and with it 
now explicitly forbidden the build will fail:


src/hotspot/os/linux/attachListener_linux.cpp: In member function 'virtual void 
LinuxAttachOperation::complete(jint, bufferedStream*)':
src/hotspot/os/linux/attachListener_linux.cpp:414:10: error: call to 'sprintf' 
declared with attribute warning: use os::snprintf [-Werror=attribute-warning]
  414 |   sprintf(msg, "%d\n", result);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~


I count ~30 sprintf:s that need updating.

I'm also curious: some of the sprintfs are C2 (src/hotspot/share/opto) - are 
your builds including C2? If so, why are you not running into the issue for 
those files?

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

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

Reply via email to