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

muparser: avoid uncaught exception on invalid variable name #11793

Merged
merged 1 commit into from
Feb 5, 2025

Conversation

dbaston
Copy link
Member

@dbaston dbaston commented Feb 4, 2025

No description provided.

}
catch (const mu::Parser::exception_type &)
{
m_bCompileFailed = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no interesting error message coming from mu::Parser we could CPLError() ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message in the exception says that the variable name is invalid but doesn't say what the name was. Still, I've moved the site of the CPLError call to print an improved message.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not to be addressed by this PR necessarily, but I'm wondering about the actual benefits of passing std::string_view as argument if we end up creating a std::string. This is slightly more verbose in term of source code, an probably also a bit in term of binary size ?

Copy link
Member Author

@dbaston dbaston Feb 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actual benefit of std::string_view is negative, as you suggest. I think the longer-term improvement would be for CPLDebug and friends to accept a std::string_view argument instead of requiring everything be a C string. I haven't looked into it at all though, maybe there's some reason that won't work. Or maybe we should hold out for a couple of years and switch to std::format.

@rouault rouault merged commit f4ae692 into OSGeo:master Feb 5, 2025
38 checks passed
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.

2 participants