Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: preventing crash due to overflow for large int vectors by circumventing VNL dot_product #2

Conversation

romangrothausmann
Copy link

ITK-Snap crashed when opening large datasets. It seems this was caused by an integer overflow when calculating a pointer index. The function used dot_product from VNL, which does not check for overflows (http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_sse.h;h=04f930ef05bb49036e1fa69d6fe9ae9a697e2d45;hb=HEAD#l189). Doing the calculation avoiding VNL allows to use a simple cast to size_t before multiplication.
This solved the issue for me. I can now load a grey image of about 10GB plus a 40GB segmentation into ITK-Snap, modify it (even in gWS mode) and then render the segmentation without any problems.
Perhaps using size_t for the vectors used for index calculation (instead of Vector3i) might be a cleaner approach. I'm not sure, but the casting solution might slow down ITK-Snap and is only needed for big datasets. Perhaps a pre-check for overflow could be introduced and dot_product used as long as possible.
I'm not sure if it is a good idea to encourage users to use ITK-Snap for such big datasets. If they shouldn't, ITK-Snap should at least through an exception that the dataset to be loaded is too big instead of crash.

@romangrothausmann
Copy link
Author

Closing PR as the changes were merged at SF (http://sourceforge.net/p/itk-snap/src/ci/20152435b5be3371fcb71e9d6d8b37d17cafc91b/)

@romangrothausmann romangrothausmann deleted the master+Debug_IRISSlicer branch January 30, 2018 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant