@@ -1169,6 +1169,10 @@ function handleMacCrashFileRead(err: NodeJS.ErrnoException | undefined | null, d
11691169 logMacCrashTelemetry ( data ) ;
11701170}
11711171
1172+ function containsUnexpectedTelemetryCharacter ( str : string ) : boolean {
1173+ return str . includes ( "/" ) || str . includes ( "\\" ) || str . includes ( "@" ) ;
1174+ }
1175+
11721176async function handleCrashFileRead ( crashDirectory : string , crashFile : string , crashDate : Date , err : NodeJS . ErrnoException | undefined | null , data : string ) : Promise < void > {
11731177 if ( err ) {
11741178 if ( err . code === "ENOENT" ) {
@@ -1193,10 +1197,15 @@ async function handleCrashFileRead(crashDirectory: string, crashFile: string, cr
11931197 if ( lines [ 0 ] === "LOG" ) {
11941198 let crashLogLine : number = 1 ;
11951199 for ( ; crashLogLine < lines . length ; ++ crashLogLine ) {
1196- if ( lines [ crashLogLine ] === "ENDLOG" ) {
1200+ const pendingCrashLogLine = lines [ crashLogLine ] ;
1201+ if ( pendingCrashLogLine === "ENDLOG" ) {
11971202 break ;
11981203 }
1199- crashLog += lines [ crashLogLine ] + "\n" ;
1204+ if ( ! containsUnexpectedTelemetryCharacter ( pendingCrashLogLine ) ) {
1205+ crashLog += pendingCrashLogLine + "\n" ;
1206+ } else {
1207+ crashLog += "<unexpectedCharacter>\n" ;
1208+ }
12001209 }
12011210 crashLog = crashLog . trimEnd ( ) ;
12021211 crashStackStartLine = ++ crashLogLine ;
@@ -1266,7 +1275,7 @@ async function handleCrashFileRead(crashDirectory: string, crashFile: string, cr
12661275 const offsetPos2 : number = offsetPos + offsetStr . length ;
12671276 if ( isMac ) {
12681277 const pendingOffset : string = line . substring ( offsetPos2 ) ;
1269- if ( ! pendingOffset . includes ( "/" ) && ! pendingOffset . includes ( "\\" ) && ! pendingOffset . includes ( "@" ) ) {
1278+ if ( ! containsUnexpectedTelemetryCharacter ( pendingOffset ) ) {
12701279 crashCallStack += pendingOffset ;
12711280 } else {
12721281 crashCallStack += "<offsetUnexpectedCharacter>" ;
@@ -1285,7 +1294,7 @@ async function handleCrashFileRead(crashDirectory: string, crashFile: string, cr
12851294 continue ; // unexpected
12861295 }
12871296 const pendingOffset : string = line . substring ( offsetPos2 , endPos ) ;
1288- if ( ! pendingOffset . includes ( "/" ) && ! pendingOffset . includes ( "\\" ) && ! pendingOffset . includes ( "@" ) ) {
1297+ if ( ! containsUnexpectedTelemetryCharacter ( pendingOffset ) ) {
12891298 crashCallStack += pendingOffset ;
12901299 } else {
12911300 crashCallStack += "<offsetUnexpectedCharacter>" ;
@@ -1309,7 +1318,7 @@ async function handleCrashFileRead(crashDirectory: string, crashFile: string, cr
13091318 data = data . substring ( 0 , 8191 ) + "…" ;
13101319 }
13111320
1312- if ( addressData . includes ( "/" ) || addressData . includes ( "\\" ) || addressData . includes ( "@" ) ) {
1321+ if ( containsUnexpectedTelemetryCharacter ( addressData ) ) {
13131322 addressData = "<addressDataUnexpectedCharacter>" ;
13141323 }
13151324
0 commit comments