Skip to content

Commit

Permalink
Subtract encoding entry size in raw2trace too
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinav92003 committed Nov 22, 2023
1 parent d35869c commit 5a54cb6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions clients/drcachesim/tracer/raw2trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,12 @@ module_mapper_t::do_encoding_parsing()
uint64_t cumulative_encoding_length = 0;
while (map_at < map_end) {
encoding_entry_t *entry = reinterpret_cast<encoding_entry_t *>(map_at);
if (entry->length < sizeof(encoding_entry_t))
if (entry->length <= sizeof(encoding_entry_t))
return "Encoding file is corrupted";
if (map_at + entry->length > map_end)
return "Encoding file is truncated";
cum_block_enc_len_to_encoding_id_[cumulative_encoding_length] = entry->id;
cumulative_encoding_length += entry->length;
cumulative_encoding_length += (entry->length - sizeof(encoding_entry_t));
encodings_[entry->id] = entry;
map_at += entry->length;
}
Expand Down

0 comments on commit 5a54cb6

Please sign in to comment.