RFR: 8345043: [ASAN] methodMatcher.cpp report reading from a region of size 0 [-Werror=stringop-overread]

SendaoYan syan at openjdk.org
Wed Nov 27 07:53:09 UTC 2024


Hi all,
The file src/hotspot/share/compiler/methodMatcher.cpp report compile warning by gcc14 with -fsanitize=address `‘size_t strlen(const char*)’ reading 1 or more bytes from a region of size 0 [-Werror=stringop-overread]`. I think it's false positive, the `if (name[0] == '*')` and `if (strlen(name) == 1)` judgement has make sure that the length of name greater or equal to 2, but the static analyze at compile time is unable to identify that.
So this PR add PRAGMA_DISABLE_GCC_WARNING("-Wstringop-overread") for the line to disable the false positive gcc warning.  Risk is low.

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

Commit messages:
 - 8345043: [ASAN] methodMatcher.cpp report reading 1 or more bytes from a region of size 0 [-Werror=stringop-overread] by gcc14

Changes: https://git.openjdk.org/jdk/pull/22406/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=22406&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8345043
  Stats: 15 lines in 3 files changed: 14 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/22406.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/22406/head:pull/22406

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


More information about the hotspot-dev mailing list