Page MenuHomePhabricator

BugFix: When using an empty Itk::Image, mitk::Image crashes
Closed, ResolvedPublic

Event Timeline

When does it crash? After ImportItkImage? Could you provide an example?

Just avoid std::memcpy when data is NULL

Since there are many memcpy calls in the image memory management I would like to understand under which circumstances this happens so we could also adopt the mitkImageTest accordingly. The description suggests it's related to ITK image.

cc xavier who submitted the patch

Dear Xavier,
afaik it is not valid to use memcpy with any argument = NULL.
So, using an empty, non-initialized ITK image should result in

memcpy( dst, NULL, 0 );

which simply does nothing.
Could you give a code example from where your error occurs?

There was a "not" too much in my last comment.
I mean it IS valid to use memcpy with any argument = NULL;

Dear Tobias,

Sorry for the late answer. I checked the code again and I cannot remember how was happening the error. If it happens again, I will let you know.

Thanks!
Xavi

status? can we close this? xavi, please confirm

Hi Michael,

Yes, you can close this issue. Thanks!

closing. confirmed by reporter