Conversation
Signed-off-by: Anastasia Basho <anastasia.basho@huawei.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e10ec11b19
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| struct version_header *header = | ||
| (struct version_header *)coldtrace_writer_reserve( | ||
| (struct coldtrace_writer *)impl, sizeof(struct version_header)); | ||
| *header = current_version_header; |
There was a problem hiding this comment.
Check reserve result before writing version header
create_coldtrace_version_header unconditionally dereferences the pointer returned by coldtrace_writer_reserve, but coldtrace_writer_reserve explicitly returns NULL when the backing mapping is MAP_FAILED/NULL (e.g., mmap/open failure paths in get_trace_/new_trace_). With this change, those recoverable allocation errors become an immediate null-deref crash at header write time instead of being propagated to callers.
Useful? React with 👍 / 👎.
| { | ||
| struct version_header *file_header = coldtrace_version_header(page); | ||
|
|
||
| if (!version_header_equal(*file_header)) { |
There was a problem hiding this comment.
Skip version validation for empty trace pages
validate_coldtrace_version_header dereferences page as a version_header without checking for an empty/absent buffer. coldtrace_writer_fini always calls coldtrace_writer_close even when no reservation ever happened (impl->buffer == NULL, impl->offset == 0), so this new validation can segfault for threads that produced no events (and in write-disabled flows where no header is written). Add a null/size guard before reading the header.
Useful? React with 👍 / 👎.
No description provided.