Bug 1711126 - The module index in the third-party modules ping may be -1. r=mhowell

This patch updates the regex pattern to match data where the module index of
a callstack is -1 or a non-negative integer.  -1 is legitimately set in
`CreateJSStackObject` when the frame address is not within any module in the
module list.

If the pattern did not match in debug build, calling `toBoolean()` hit the
assert because `matchResult` was not a boolean but null.  This patch fixes
that problem, too.

Differential Revision: https://phabricator.services.mozilla.com/D122020
This commit is contained in:
Toshihito Kikuchi 2021-08-06 19:18:49 +00:00
Родитель 0a6caa933f
Коммит 547568f702
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -236,7 +236,7 @@ class UntrustedModulesFixture : public TelemetryTestFixture {
// On match, with aOnlyMatch = true, ExecuteRegExpNoStatics returns boolean
// true. If no match, ExecuteRegExpNoStatics returns Null.
EXPECT_TRUE(matchResult.isBoolean() && matchResult.toBoolean());
if (!matchResult.toBoolean()) {
if (!matchResult.isBoolean() || !matchResult.toBoolean()) {
// If match failed, print out the actual JSON kindly.
wprintf(L"JSON: %s\n", json.get());
wprintf(L"RE: %s\n", aPattern);
@ -366,8 +366,8 @@ BOOL CALLBACK UntrustedModulesFixture::InitialModuleLoadOnce(PINIT_ONCE, void*,
u"\"combinedStacks\":{" \
u"\"memoryMap\":\\[\\[\"\\w+\\.\\w+\",\"[0-9A-Z]+\"\\]" \
u"(,\\[\"\\w+\\.\\w+\",\"[0-9A-Z]+\\\"\\])*\\]," \
u"\"stacks\":\\[\\[\\[\\d+,\\d+\\]" \
u"(,\\[\\d+,\\d+\\])*\\]\\]}}"
u"\"stacks\":\\[\\[\\[(-1|\\d+),\\d+\\]" \
u"(,\\[(-1|\\d+),\\d+\\])*\\]\\]}}"
TEST_F(UntrustedModulesFixture, Serialize) {
// clang-format off