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

Infinite recursion in basic exception handler #1141

Closed
jolting opened this issue Feb 27, 2021 · 2 comments · Fixed by #1142
Closed

Infinite recursion in basic exception handler #1141

jolting opened this issue Feb 27, 2021 · 2 comments · Fixed by #1142

Comments

@jolting
Copy link
Member

jolting commented Feb 27, 2021

ret = e.what();

This should be

const auto* ecb = dynamic_cast<const ExceptionWithCallBackBase*>(&e);
if(ecb)
{
  ret = ecb->originalWhat;
}
else
{
  ret = e->what();
}

Since m_what is empty.

call exception_to_str

std::string mrpt::exception_to_str(const std::exception& e)

call impl_excep_to_str
void impl_excep_to_str(

call basic version
ret = e.what();

call e.what(), m_what is still empty
if (m_what.empty()) m_what = mrpt::exception_to_str(*this);

repeat steps 1-4.

@jolting
Copy link
Member Author

jolting commented Feb 27, 2021

@jlblancoc
Copy link
Member

Wow!! Excellent finding.

@jlblancoc jlblancoc linked a pull request Feb 27, 2021 that will close this issue
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 a pull request may close this issue.

2 participants