mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-15 15:49:36 +02:00
Bug 1398 - Metadata Editor tag fields emptied when field length stored in project exceeds a given length
This commit is contained in:
parent
0c234359af
commit
7547de9f52
@ -558,7 +558,7 @@ bool Tags::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
|||||||
wxString value = *attrs++;
|
wxString value = *attrs++;
|
||||||
|
|
||||||
if (!XMLValueChecker::IsGoodString(attr) ||
|
if (!XMLValueChecker::IsGoodString(attr) ||
|
||||||
!XMLValueChecker::IsGoodString(value)) {
|
!XMLValueChecker::IsGoodLongString(value)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,19 +36,20 @@
|
|||||||
// Length check. Is in part about not supplying malicious strings to file functions.
|
// Length check. Is in part about not supplying malicious strings to file functions.
|
||||||
bool XMLValueChecker::IsGoodString(const wxString & str)
|
bool XMLValueChecker::IsGoodString(const wxString & str)
|
||||||
{
|
{
|
||||||
size_t len = str.length();
|
// Originally based on MAX_PATH, which is way too limiting and just wrong since
|
||||||
int nullIndex = str.Find('\0', false);
|
// the length check is for a plain string and not a filename
|
||||||
if ((len <= PLATFORM_MAX_PATH) && // Shouldn't be any reason for longer strings, except intentional file corruption.
|
if (IsGoodLongString(str) && str.length() <= 4096) // Shouldn't be any reason for longer strings, except intentional file corruption.
|
||||||
(nullIndex == -1)) // No null characters except terminator.
|
{
|
||||||
return true;
|
return true;
|
||||||
else
|
}
|
||||||
return false; // good place for a breakpoint
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// No length check, as e.g. labels could be very long.
|
// No length check, as e.g. labels could be very long.
|
||||||
bool XMLValueChecker::IsGoodLongString(const wxString & str)
|
bool XMLValueChecker::IsGoodLongString(const wxString & str)
|
||||||
{
|
{
|
||||||
return str.Find('\0', false) == -1; // No null characters except terminator.
|
return str.Find('\0', false) == wxNOT_FOUND; // No null characters except terminator.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user