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 20, 2020
1 parent b494c82 commit 191ed53
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pdal/util/Utils.cpp
Original file line number Diff line number Diff line change
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 191ed53

Please sign in to comment.