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

Empty Polydata causes exception #74

Open
z0022myy opened this issue Jan 11, 2016 · 0 comments
Open

Empty Polydata causes exception #74

z0022myy opened this issue Jan 11, 2016 · 0 comments

Comments

@z0022myy
Copy link
Contributor

If an empty polydata (without setting any points, lines) is sent, an runtime exception will be thrown when unpacking the data. The exception is only occured in the release mode. The reason is that if the points is NULL, the PackBody() call in the igtlPolyDataMessage.cxx will return immediately without setting the polydata header. Thus, the data in the polydata header is incorrect during unpacking.

The error can be reproduced with the PolyData example, in which we create a new function e.g. SendEmptyPolyData as follows:

int SendEmptyPolyData(igtl::Socket::Pointer& socket, const char* name)
{
igtl::PolyDataMessage::Pointer polyDataMsg;
polyDataMsg = igtl::PolyDataMessage::New();

polyDataMsg->SetDeviceName(name);
polyDataMsg->Pack();

socket->Send(polyDataMsg->GetPackPointer(), polyDataMsg->GetPackSize());
return 1;
}

and call this function instead of SendPolyData.

z0022myy pushed a commit to z0022myy/OpenIGTLink that referenced this issue Jan 11, 2016
tokjun added a commit that referenced this issue Jan 11, 2016
BUG: empty polydata causes exception. #74
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

No branches or pull requests

1 participant