Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion tools/logger/convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,14 @@ static const char *format_uid(uint32_t uid_ptr, int use_colors, bool be, bool up
const struct sof_uuid_entry *uid_entry;
char *str;

/*
* The whole struct sof_uuid_entry is read at uid_ptr, so require that
* many bytes to remain in the uids region; a bare ">=" upper bound
* would accept a pointer whose entry straddles the end of the buffer.
*/
if (uid_ptr < uids_dict->base_address ||
uid_ptr >= uids_dict->base_address + uids_dict->data_length) {
uid_ptr + sizeof(struct sof_uuid_entry) >
uids_dict->base_address + uids_dict->data_length) {
Comment on lines 134 to +136

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be enough to check end_addr = uids_dict->base_address + uids_dict->data_length; if (end_addr < uids_dict->base_address) return -EOVERFLOW;

str = calloc(1, strlen(BAD_PTR_STR) + 1 + 6);
if (!str) {
log_err("can't allocate memory\n");
Expand Down
Loading