Skip to content

Commit

Permalink
Don't access invalid memory. (#2986)
Browse files Browse the repository at this point in the history
* Don't access invalid memory.

* Remove unnecessary cast.
  • Loading branch information
abellgithub committed Mar 19, 2020
1 parent ab2b953 commit 6d52a3b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pdal/util/Utils.cpp
Expand Up @@ -436,8 +436,8 @@ std::string Utils::escapeJSON(const std::string &str)
};
for (std::string::size_type i = 0; i < s.size();)
{
char val = s[i];
if (val < (char)replacements.size())
unsigned char val = s[i];
if (val < replacements.size())
{
s.replace(i, 1, replacements[val]);
i += replacements[val].size();
Expand Down

0 comments on commit 6d52a3b

Please sign in to comment.