8221833: Readability check in Symbol::is_valid not performed for some addresses
authormdoerr
Fri, 05 Apr 2019 09:18:18 +0200
changeset 54436 d5fb27646df4
parent 54435 776b261dff84
child 54437 2ae93028bef3
8221833: Readability check in Symbol::is_valid not performed for some addresses Reviewed-by: zgu, coleenp
src/hotspot/share/runtime/os.cpp
--- a/src/hotspot/share/runtime/os.cpp	Fri Apr 05 09:06:19 2019 +0200
+++ b/src/hotspot/share/runtime/os.cpp	Fri Apr 05 09:18:18 2019 +0200
@@ -1024,8 +1024,9 @@
 }
 
 bool os::is_readable_range(const void* from, const void* to) {
-  for (address p = align_down((address)from, min_page_size()); p < to; p += min_page_size()) {
-    if (!is_readable_pointer(p)) {
+  if ((uintptr_t)from >= (uintptr_t)to) return false;
+  for (uintptr_t p = align_down((uintptr_t)from, min_page_size()); p < (uintptr_t)to; p += min_page_size()) {
+    if (!is_readable_pointer((const void*)p)) {
       return false;
     }
   }