Integrated: 8345043: [ASAN] methodMatcher.cpp report reading from a region of size 0 [-Werror=stringop-overread]
SendaoYan
syan at openjdk.org
Thu Nov 28 09:09:48 UTC 2024
On Wed, 27 Nov 2024 07:48:00 GMT, SendaoYan <syan at openjdk.org> wrote:
> Hi all,
> The file src/hotspot/share/compiler/methodMatcher.cpp report compile warning by gcc14 with -fsanitize=undefined -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 change `strlen(name + 1) + 1` to `strlen(name)` to dodge gcc warning. Risk is low.
>
> Additional testing:
>
> - [x] jtreg tests(include tier1/2/3 etc.) by linux-x64 release build
> - [x] jtreg tests(include tier1/2/3 etc.) by linux-aarch64 release build
This pull request has now been integrated.
Changeset: e096660a
Author: SendaoYan <syan at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/e096660a18905bf1394d722790c5c3883e55dedc
Stats: 6 lines in 1 file changed: 2 ins; 1 del; 3 mod
8345043: [ASAN] methodMatcher.cpp report reading from a region of size 0 [-Werror=stringop-overread]
Reviewed-by: kbarrett, dholmes
-------------
PR: https://git.openjdk.org/jdk/pull/22406
More information about the hotspot-dev
mailing list