Skip to content

Commit 72e28d9

Browse files
authored
Check for more unexpected characters in crash call stack data. (#13281)
1 parent 44406ce commit 72e28d9

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

Diff for: Extension/src/LanguageServer/extension.ts

+15-3
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,11 @@ async function handleCrashFileRead(crashDirectory: string, crashFile: string, cr
12351235
}
12361236
}
12371237
if (funcStr.includes("/")) {
1238-
funcStr = "<func>";
1238+
funcStr = "<funcForwardSlash>";
1239+
} else if (funcStr.includes("\\")) {
1240+
funcStr = "<funcBackSlash>";
1241+
} else if (funcStr.includes("@")) {
1242+
funcStr = "<funcAt>";
12391243
} else if (!validFrameFound && (funcStr.startsWith("crash_handler(") || funcStr.startsWith("_sigtramp"))) {
12401244
continue; // Skip these on early frames.
12411245
}
@@ -1246,8 +1250,10 @@ async function handleCrashFileRead(crashDirectory: string, crashFile: string, cr
12461250
const offsetPos2: number = offsetPos + offsetStr.length;
12471251
if (isMac) {
12481252
const pendingOffset: string = line.substring(offsetPos2);
1249-
if (!pendingOffset.includes("/")) {
1253+
if (!pendingOffset.includes("/") && !pendingOffset.includes("\\") && !pendingOffset.includes("@")) {
12501254
crashCallStack += pendingOffset;
1255+
} else {
1256+
crashCallStack += "<offsetUnexpectedCharacter>";
12511257
}
12521258
const startAddressPos: number = line.indexOf("0x");
12531259
if (startAddressPos === -1 || startAddressPos >= startPos) {
@@ -1263,8 +1269,10 @@ async function handleCrashFileRead(crashDirectory: string, crashFile: string, cr
12631269
continue; // unexpected
12641270
}
12651271
const pendingOffset: string = line.substring(offsetPos2, endPos);
1266-
if (!pendingOffset.includes("/")) {
1272+
if (!pendingOffset.includes("/") && !pendingOffset.includes("\\") && !pendingOffset.includes("@")) {
12671273
crashCallStack += pendingOffset;
1274+
} else {
1275+
crashCallStack += "<offsetUnexpectedCharacter>";
12681276
}
12691277
}
12701278
}
@@ -1285,6 +1293,10 @@ async function handleCrashFileRead(crashDirectory: string, crashFile: string, cr
12851293
data = data.substring(0, 8191) + "…";
12861294
}
12871295

1296+
if (addressData.includes("/") || addressData.includes("\\") || addressData.includes("@")) {
1297+
addressData = "<addressDataUnexpectedCharacter>";
1298+
}
1299+
12881300
logCppCrashTelemetry(data, addressData);
12891301

12901302
await util.deleteFile(path.resolve(crashDirectory, crashFile)).catch(logAndReturn.undefined);

0 commit comments

Comments
 (0)