Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 367
Static code analysis#6858
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
Uh oh!
There was an error while loading. Please reload this page.
Static code analysis #6858
Changes from all commits
0ee22082e6053adfcc4fb8adb9acce00098File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -359,11 +359,14 @@ static inline void print_table_header(void) | ||
| fprintf(out_fd, "%s", "CONTENT"); | ||
| if (global_config->time_precision >= 0) { | ||
| struct tm *ltime = localtime(&epoc_secs); | ||
| /* e.g.: ktime=4263.487s @ 2021-04-27 14:21:13 -0700 PDT */ | ||
| fprintf(out_fd, "\tktime=%lu.%03lus", | ||
| ktime.tv_sec, ktime.tv_nsec / 1000000); | ||
| if (strftime(date_string, sizeof(date_string), | ||
| "%F %X %z %Z", localtime(&epoc_secs))) | ||
| if (ltime && strftime(date_string, sizeof(date_string), | ||
| "%F %X %z %Z", ltime)) | ||
Collaborator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would make the output look weird if Whatever is required to please the static analysis Gods. | ||
| fprintf(out_fd, " @ %s", date_string); | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an unchecked memcpy_s call which may fail and I believe in case of failure there's an issue (the destination gets zeroed out, so you need to pay attention to that to avoid bugs like this). If this returns an error you should propagate or assert it doesn't happen (using the non-removable SOF asserts). Ditto on all other memcpy_s calls in this patch.
The reason I'm requesting changes is that if this happens the bug is silent and not obvious. I hate that kind of bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this hasn't been changed by this commit. This commit doesn't increase chances of
memcpy_s()to failThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we take the memcpy_s check as a separate patch/PR. This needs to be fixed first.