Skip to content

Commit

Permalink
Merge pull request #61 from TAImatem/master
Browse files Browse the repository at this point in the history
fix "iterator after end" error on some strings
  • Loading branch information
lordofbikes authored Jun 16, 2022
2 parents 8378f39 + c9fdce5 commit 4273153
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/intern/drw_textcodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ std::string DRW_ConvTable::toUtf8(const std::string &s) {
if (c < 0x80) {
//check for \U+ encoded text
if (c == '\\') {
if (it+6 < s.end() && *(it+1) == 'U' && *(it+2) == '+') {
if (s.end()-it > 6 && *(it+1) == 'U' && *(it+2) == '+') {
res += encodeText(std::string(it, it+7));
it +=6;
} else {
Expand Down Expand Up @@ -344,7 +344,7 @@ std::string DRW_ConvDBCSTable::toUtf8(const std::string &s) {
notFound = false;
//check for \U+ encoded text
if (c == '\\') {
if (it+6 < s.end() && *(it+1) == 'U' && *(it+2) == '+') {
if (s.end()-it > 6 && *(it+1) == 'U' && *(it+2) == '+') {
res += encodeText(std::string(it, it+7));
it +=6;
} else {
Expand Down Expand Up @@ -433,7 +433,7 @@ std::string DRW_Conv932Table::toUtf8(const std::string &s) {
notFound = false;
//check for \U+ encoded text
if (c == '\\') {
if (it+6 < s.end() && *(it+1) == 'U' && *(it+2) == '+') {
if (s.end()-it > 6 && *(it+1) == 'U' && *(it+2) == '+') {
res += encodeText(std::string(it, it+7));
it +=6;
} else {
Expand Down

0 comments on commit 4273153

Please sign in to comment.