You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function getIdentifier does not properly sanitize characters from filenames.
For example the file C:\Users\foobar\AppData\Local\Temp\demo-sample.cpp generate the identifier demo-sample which contains the invalid c++ character - (dash).
The function must remove all invalid c++ characters such as +-*/=!"/$%?&()½¾.,;<>^¸¨: .
The text was updated successfully, but these errors were encountered:
The solution is to change the implementation of getIdentifier() function by the following :
inline std::string filter(std::string str, const std::string & valid_characters)
{
std::string output;
//reserve as many characters as in input string
output.reserve(str.size());
//for each characters in input stringfor(size_t i=0; i < str.size(); i++)
{
//is the current character is found in valid characters?size_t pos = valid_characters.find(str[i], 0);
if (pos != std::string::npos)
output.append(1, str[i]);
}
return output;
}
std::string getFunctionIdentifierFromPath(const std::string & path)
{
std::string id;
//get filename of the given path
id = ra::filesystem::GetFilenameWithoutExtension(path.c_str());
// filter out characters which are not alphanumeric characters or '_'.staticconst std::string validCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
id = filter(id, validCharacters);
return id;
}
and to remove usage of function getIdentifier() at line 491 to generate files using the same filename as the original.
…racters.
* Moved html5skeleton sample source code under samples/demo_helloworld.
* Fixed implementation of `getCppIncludeGuardMacroName()`.
* Implemented many steps specified in issue #41.
The function getIdentifier does not properly sanitize characters from filenames.
For example the file
C:\Users\foobar\AppData\Local\Temp\demo-sample.cpp
generate the identifierdemo-sample
which contains the invalid c++ character-
(dash).The function must remove all invalid c++ characters such as
+-*/=!"/$%?&()½¾.,;<>^¸¨:
.The text was updated successfully, but these errors were encountered: