mirror of
https://github.com/corda/corda.git
synced 2025-01-19 03:06:36 +00:00
Don't access potentially mis-aligned, non-existent length field for non-array objects (fixes #486)
This commit is contained in:
parent
134d10960b
commit
95cd300bbd
@ -1987,11 +1987,14 @@ inline unsigned baseSize(Thread* t UNUSED, object o, GcClass* class_)
|
||||
{
|
||||
assertT(t, class_->fixedSize() >= BytesPerWord);
|
||||
|
||||
return ceilingDivide(class_->fixedSize(), BytesPerWord)
|
||||
+ ceilingDivide(class_->arrayElementSize()
|
||||
* fieldAtOffset<uintptr_t>(
|
||||
o, class_->fixedSize() - BytesPerWord),
|
||||
BytesPerWord);
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user