Skip to content

Commit

Permalink
#2302: Add more buffer boundary check
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrepebay committed Dec 12, 2024
1 parent a971233 commit e057fb8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/vt/metrics/perf_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ std::unordered_map<std::string, uint64_t> PerfData::getTaskMeasurements() {
uint64_t count = 0;

if (event_fds_[i] != -1) {
if (sizeof(count) != sizeof(uint64_t)) {
vtAbort("Buffer size mismatch: expected " + std::to_string(sizeof(uint64_t)) +
" bytes, but got " + std::to_string(sizeof(count)));
}

ssize_t bytesRead = read(event_fds_[i], &count, sizeof(count));

if (bytesRead == sizeof(count)) {
Expand Down

0 comments on commit e057fb8

Please sign in to comment.