File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 2626#define SHARE_MEMORY_GUARDEDMEMORY_HPP
2727
2828#include " memory/allocation.hpp"
29+ #include " runtime/os.hpp"
2930#include " runtime/safefetch.hpp"
3031#include " utilities/globalDefinitions.hpp"
3132
@@ -113,14 +114,14 @@ class GuardedMemory : StackObj { // Wrapper on stack
113114 }
114115
115116 bool verify () const {
117+ // We may not be able to dereference directly.
118+ if (!os::is_readable_range ((const void *) _guard, (const void *) (_guard + GUARD_SIZE))) {
119+ return false ;
120+ }
116121 u_char* c = (u_char*) _guard;
117122 u_char* end = c + GUARD_SIZE;
118123 while (c < end) {
119- // We may not be able to dereference directly so use
120- // SafeFetch. It doesn't matter if the value read happens
121- // to be 0xFF as that is not what we expect anyway.
122- u_char val = (u_char) (SafeFetch32 ((int *)c, 0xFF ) BIG_ENDIAN_ONLY (>> 24 ));
123- if (val != badResourceValue) {
124+ if (*c != badResourceValue) {
124125 return false ;
125126 }
126127 c++;
You can’t perform that action at this time.
0 commit comments