Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
Log if invalid utf8 string is read
Browse files Browse the repository at this point in the history
  • Loading branch information
np-c0mp1ete committed Nov 21, 2021
1 parent d556b7e commit 1ae6589
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/apps/ENGINE/src/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6120,7 +6120,10 @@ char *COMPILER::ReadString()

char *pBuffer = new char[n];
ReadData(pBuffer, n);
Assert(utf8::IsValidUtf8(pBuffer));
if (!utf8::IsValidUtf8(pBuffer))
{
spdlog::warn("Deserializing invalid utf8 string: {}", pBuffer);
}
return pBuffer;
}

Expand Down Expand Up @@ -6613,7 +6616,6 @@ bool COMPILER::LoadState(std::fstream &fileS)
pString = ReadString();
if (pString)
{
Assert(utf8::IsValidUtf8(pString));
SCodec.Convert(pString);
delete[] pString;
}
Expand All @@ -6630,7 +6632,6 @@ bool COMPILER::LoadState(std::fstream &fileS)
for (n = 0; n < nSegments2Load; n++)
{
char *pSegmentName = ReadString();
Assert(utf8::IsValidUtf8(pSegmentName));
if (!BC_LoadSegment(pSegmentName))
return false;
delete[] pSegmentName;
Expand Down

0 comments on commit 1ae6589

Please sign in to comment.