RFR: 8308071: [REDO] update for deprecated sprintf for src/utils [v3]

Kim Barrett kbarrett at openjdk.org
Wed May 17 08:58:49 UTC 2023


On Wed, 17 May 2023 05:49:00 GMT, Xue-Lei Andrew Fan <xuelei at openjdk.org> wrote:

>> Hi,
>> 
>> This is a redo of JDK-8307855, where issues were found after integration.
>> 
>> The sprintf is deprecated in Xcode 14, and Microsoft Virtual Studio, because of security concerns. The issue was addressed in [JDK-8296812](https://bugs.openjdk.org/browse/JDK-8296812) for building failure, and [JDK-8299378](https://bugs.openjdk.org/browse/JDK-8299378)/[JDK-8299635](https://bugs.openjdk.org/browse/JDK-8299635)/[JDK-8301132](https://bugs.openjdk.org/browse/JDK-8301132) for testing issues . This is a break-down update for sprintf uses in the src/utils directory.
>> 
>> Thanks,
>> Xuelei
>
> Xue-Lei Andrew Fan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   check returned value of snprintf

Changes requested by kbarrett (Reviewer).

src/utils/hsdis/binutils/hsdis-binutils.c line 246:

> 244: 
> 245:   size_t used_size = snprintf(buf, bufsize, "%s", close);
> 246:   if ((used_size < 0) || (used_size >= bufsize)) {

(used_size < 0) is tautologically false, since used_size is a size_t, so unsigned.  I'm somewhat surprised
this doesn't trigger a warning from some compiler.

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

PR Review: https://git.openjdk.org/jdk/pull/13995#pullrequestreview-1430144188
PR Review Comment: https://git.openjdk.org/jdk/pull/13995#discussion_r1196161411



More information about the build-dev mailing list