Bug 1423000 - Reject some more invalid logalloc replay logs. r?njn
For functions with no result, such as free, it's invalid for some string
to appear after the closing parenthesis.
--- a/memory/replace/logalloc/replay/Replay.cpp
+++ b/memory/replace/logalloc/replay/Replay.cpp
@@ -390,16 +390,19 @@ public:
MemSlot& old_slot = (*this)[slot_id];
void* old_ptr = old_slot.mPtr;
old_slot.mPtr = nullptr;
aSlot.mPtr = ::realloc_impl(old_ptr, size);
}
void free(Buffer& aArgs, Buffer& aResult)
{
+ if (aResult) {
+ die("Malformed input");
+ }
mOps++;
Buffer dummy = aArgs.SplitChar('#');
if (dummy) {
die("Malformed input");
}
size_t slot_id = parseNumber(aArgs);
MemSlot& slot = (*this)[slot_id];
::free_impl(slot.mPtr);
@@ -420,17 +423,17 @@ public:
MemSlot& aSlot = SlotForResult(aResult);
mOps++;
size_t size = parseNumber(aArgs);
aSlot.mPtr = ::valloc_impl(size);
}
void jemalloc_stats(Buffer& aArgs, Buffer& aResult)
{
- if (aArgs) {
+ if (aArgs || aResult) {
die("Malformed input");
}
mOps++;
jemalloc_stats_t stats;
::jemalloc_stats(&stats);
FdPrintf(mStdErr,
"#%zu mapped: %zu; allocated: %zu; waste: %zu; dirty: %zu; "
"bookkeep: %zu; binunused: %zu\n", mOps, stats.mapped,