Skip to content

Commit

Permalink
Avoid address overflow (HostImage)
Browse files Browse the repository at this point in the history
  • Loading branch information
atakagi-fixstars committed Aug 10, 2023
1 parent 0a1cd3e commit bd8966b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/host_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ class HostImage
memcpy(rhs.data, data, elemSize(type) * rows * step);
}

template <typename T> T* ptr(int y = 0) { return (T*)data + y * step; }
template <typename T> const T* ptr(int y = 0) const { return (T*)data + y * step; }
template <typename T> T* ptr(int y = 0) { return (T*)data + y * (size_t)step; }
template <typename T> const T* ptr(int y = 0) const { return (T*)data + y * (size_t)step; }

void* data;
int rows, cols, step;
Expand Down

0 comments on commit bd8966b

Please sign in to comment.