Merge pull request #487 from joshuawarner32/master

Don't access length field of non-array objects (fixes #486)
This commit is contained in:
Joel Dice 2016-05-26 14:06:22 -06:00
commit a230a6f4dc

View File

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