-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use JavaFrameAnchor from TLS if available in vmstructs based stackwalker #186
base: main
Are you sure you want to change the base?
Conversation
🔧 Report generated by pr-comment-scanbuild Scan-Build Report
Bug Summary
Reports
|
3ff61c5
to
f9dd63f
Compare
const char *name = cc == NULL ? NULL : cc->binarySearch(pc); | ||
|
||
if (name == nullptr) { | ||
snprintf(hexBuffer, sizeof(hexBuffer), "%p", (uintptr_t)pc); |
Check failure
Code scanning / CodeQL
Wrong type of arguments to formatting function High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 2 days ago
To fix the problem, we need to ensure that the format specifier matches the type of the argument passed to snprintf
. Since pc
is cast to uintptr_t
, which is an unsigned integer type, we should use a format specifier that matches this type. The correct format specifier for an unsigned long integer is %lx
or %lu
depending on the exact type. In this case, %lx
is appropriate for uintptr_t
.
- Change the format specifier from
%p
to%lx
in thesnprintf
call. - This change should be made in the file
ddprof-lib/src/main/cpp/stackWalker.cpp
on line 427.
-
Copy modified line R427
@@ -426,3 +426,3 @@ | ||
if (name == nullptr) { | ||
snprintf(hexBuffer, sizeof(hexBuffer), "%p", (uintptr_t)pc); | ||
snprintf(hexBuffer, sizeof(hexBuffer), "%lx", (uintptr_t)pc); | ||
name = hexBuffer; |
f9dd63f
to
500b058
Compare
500b058
to
dbb6212
Compare
What does this PR do?:
Motivation:
Additional Notes:
How to test the change?:
For Datadog employees:
credentials of any kind, I've requested a review from
@DataDog/security-design-and-guidance
.Unsure? Have a question? Request a review!