提交 dc370163 编写于 作者: J johnc

6943926: G1: Integer overflow during heap region verification

Summary: The expression that calculates the live bytes for a heap region can overflow for a suitably large humongous region/object. Cache the object size in a suitably sized local variable so that the expression is converted to a wider type.
Reviewed-by: tonyp, jmasa, iveresov, apetrusenko
上级 ea61bdd9
...@@ -2194,8 +2194,10 @@ public: ...@@ -2194,8 +2194,10 @@ public:
assert(o != NULL, "Huh?"); assert(o != NULL, "Huh?");
if (!_g1h->is_obj_dead_cond(o, _use_prev_marking)) { if (!_g1h->is_obj_dead_cond(o, _use_prev_marking)) {
o->oop_iterate(&isLive); o->oop_iterate(&isLive);
if (!_hr->obj_allocated_since_prev_marking(o)) if (!_hr->obj_allocated_since_prev_marking(o)) {
_live_bytes += (o->size() * HeapWordSize); size_t obj_size = o->size(); // Make sure we don't overflow
_live_bytes += (obj_size * HeapWordSize);
}
} }
} }
size_t live_bytes() { return _live_bytes; } size_t live_bytes() { return _live_bytes; }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册