FluidityProject / fluidity

Fluidity
http://fluidity-project.org
Other
365 stars 115 forks source link

Allocate empty attribute arrays for detectors #320

Closed angus-g closed 3 years ago

angus-g commented 3 years ago

(Duplicated from #319)

When we allocate/unpack detectors from Zoltan, some code expects that their attribute arrays (used for particles) are at least allocated, even if length 0. Ensuring this is done avoids potential segfaults when these arrays are unconditionally accessed.

Thanks @stephankramer for the detailed analysis of this issue! I think this is probably the right place for this allocation? Of course, the other approach would be to figure out where attribute_size is being passed into unpack_detector as a non-optional on a detector. (As an aside, that subroutine looks like it could just take a non-optional attribute_size and then the logic wouldn't be exactly duplicated in both branches...)

Closes #317.

stephankramer commented 3 years ago

Oh except there are now new (I believe?) particle test failures...

angus-g commented 3 years ago

Ah yes, I was going to ask whether those were existing or not...I might have to dig a bit deeper into what's going on!

tmbgreaves commented 3 years ago

All green on the PR now, thanks @angus-g :-)

@stephankramer - might you be able to review again please and merge if you're happy?