mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-14 15:20:29 +02:00
Bug 2572 - Multi-byte characters may corrupt Json from mod-script-pipe
This commit is contained in:
parent
a2cee50c01
commit
a7360e74b7
@ -162,8 +162,8 @@ int DoSrvMore(char *pOut, size_t nMax)
|
|||||||
size_t totalLines = aStr.GetCount();
|
size_t totalLines = aStr.GetCount();
|
||||||
while (currentLine < totalLines)
|
while (currentLine < totalLines)
|
||||||
{
|
{
|
||||||
wxString lineString = aStr[currentLine];
|
wxCharBuffer lineString = aStr[currentLine].ToUTF8();
|
||||||
size_t lineLength = lineString.mb_str().length();
|
size_t lineLength = lineString.length();
|
||||||
size_t charsLeftInLine = lineLength - currentPosition;
|
size_t charsLeftInLine = lineLength - currentPosition;
|
||||||
|
|
||||||
wxASSERT(charsLeftInLine >= 0);
|
wxASSERT(charsLeftInLine >= 0);
|
||||||
@ -179,8 +179,7 @@ int DoSrvMore(char *pOut, size_t nMax)
|
|||||||
// Write as much of the rest of the line as will fit in the buffer
|
// Write as much of the rest of the line as will fit in the buffer
|
||||||
size_t charsToWrite = smin(charsLeftInLine, nMax - 1);
|
size_t charsToWrite = smin(charsLeftInLine, nMax - 1);
|
||||||
memcpy(pOut,
|
memcpy(pOut,
|
||||||
lineString.Mid(currentPosition,
|
&(lineString.data()[currentPosition]),
|
||||||
currentPosition + charsToWrite).mb_str(),
|
|
||||||
charsToWrite);
|
charsToWrite);
|
||||||
pOut[charsToWrite] = '\0';
|
pOut[charsToWrite] = '\0';
|
||||||
currentPosition += charsToWrite;
|
currentPosition += charsToWrite;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user