8332461: ubsan : dependencies.cpp:906:3: runtime error: load of value 4294967295, which is not a valid value for type 'DepType'

Reviewed-by: stefank, kvn, dlong
This commit is contained in:
Amit Kumar 2024-09-05 07:01:29 +00:00
parent 96df5a6d8f
commit 28de44da71
2 changed files with 5 additions and 2 deletions
src/hotspot/share/code

@ -893,7 +893,7 @@ void Dependencies::DepStream::print_dependency(outputStream* st, Klass* witness,
void Dependencies::DepStream::initial_asserts(size_t byte_limit) {
assert(must_be_in_vm(), "raw oops here");
_byte_limit = byte_limit;
_type = (DepType)(end_marker-1); // defeat "already at end" assert
_type = undefined_dependency; // defeat "already at end" assert
assert((_code!=nullptr) + (_deps!=nullptr) == 1, "one or t'other");
}
#endif //ASSERT

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -103,6 +103,9 @@ class Dependencies: public ResourceObj {
// type now includes N, that is, all super types of N.
//
enum DepType {
// _type is initially set to -1, to prevent "already at end" assert
undefined_dependency = -1,
end_marker = 0,
// An 'evol' dependency simply notes that the contents of the