Don't access potentially mis-aligned, non-existent length field for non-array objects (fixes #486)

This commit is contained in:
Joshua Warner 2016-05-26 14:35:13 +00:00
parent 134d10960b
commit 95cd300bbd

View File

@ -1987,12 +1987,15 @@ inline unsigned baseSize(Thread* t UNUSED, object o, GcClass* class_)
{
assertT(t, class_->fixedSize() >= BytesPerWord);
return ceilingDivide(class_->fixedSize(), BytesPerWord)
+ ceilingDivide(class_->arrayElementSize()
unsigned size = ceilingDivide(class_->fixedSize(), BytesPerWord);
if (class_->arrayElementSize() > 0) {
size += ceilingDivide(class_->arrayElementSize()
* fieldAtOffset<uintptr_t>(
o, class_->fixedSize() - BytesPerWord),
BytesPerWord);
}
return size;
}
object makeTrace(Thread* t, Processor::StackWalker* walker);