Skip to content

Address comments in PR#794 and alternative fix for ticket #7500.#796

Merged
amai2012 merged 1 commit into
cppcheck-opensource:masterfrom
simartin:ticket_7452_follow_up
May 21, 2016
Merged

Address comments in PR#794 and alternative fix for ticket #7500.#796
amai2012 merged 1 commit into
cppcheck-opensource:masterfrom
simartin:ticket_7452_follow_up

Conversation

@simartin
Copy link
Copy Markdown
Contributor

This addresses the remark @amai2012 made in 3af30e7 and implements an alternative fix (IMHO better) for ticket #7500.

Simon

Comment thread lib/mathlib.cpp
// clang and gcc seem to use the following encoding: 'AB' as (('A' << 8) | 'B')
const std::string& normStr = normalizeCharacterLiteral(str);
if (normStr.empty())
throw InternalError(0, "Internal Error. MathLib::characterLiteralToLongNumber: Unhandled char constant '" + str + "'.");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe keep that security check? normalizeCharacterLiteral() is non-trivial, maybe it can still fail somehow or after some future modifications.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I see the semantics of normalizeCharacterLiteral as "give me a valid literal or throw". Should we encounter crashes in the future, I'd rather we fix normalizeCharacterLiteral than leave them go unnoticed.

@amai2012
Copy link
Copy Markdown
Collaborator

Ok, let's try.

@amai2012 amai2012 merged commit b60b283 into cppcheck-opensource:master May 21, 2016
@simartin simartin deleted the ticket_7452_follow_up branch May 21, 2016 07:27
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