Skip to content

Commit ce1b8d1

Browse files
fix: Crash in profiling logger (#1964)
Call va_end after creating the NSString *, otherwise this is undefined behavior and can crash. Co-authored-by: Sentry Github Bot <[email protected]>
1 parent 0be48b6 commit ce1b8d1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- Properly sanitize the event context and SDK information (#1943)
1313
- Don't send error 429 as `network_error` (#1957)
1414
- Deprecate not needed option `sdkInfo` (#1960)
15+
- Crash in profiling logger (#1964)
1516

1617
## 7.20.0
1718

Sources/Sentry/SentryProfilingLogging.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333
}
3434
va_list args;
3535
va_start(args, fmt);
36-
va_end(args);
3736
const auto fmtStr = [[NSString alloc] initWithUTF8String:fmt];
38-
[SentryLog logWithMessage:[[NSString alloc] initWithFormat:fmtStr arguments:args]
39-
andLevel:sentryLevelFromLogLevel(level)];
37+
const auto msgStr = [[NSString alloc] initWithFormat:fmtStr arguments:args];
38+
va_end(args);
39+
[SentryLog logWithMessage:msgStr andLevel:sentryLevelFromLogLevel(level)];
4040
}
4141

4242
} // namespace profiling

0 commit comments

Comments
 (0)