Skip to content

Commit 16750ee

Browse files
committed
static_data_buffer: bounds checking in seek()
1 parent 4641613 commit 16750ee

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

utility/static_data_buffer.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,13 @@ class static_data_buffer
5858
return _pos;
5959
}
6060

61-
constexpr void seek(const size_t pos) & noexcept
61+
[[nodiscard]] constexpr bool seek(const size_t pos) & noexcept
6262
{
63+
if (pos > MaxSize) [[unlikely]]
64+
return false;
65+
6366
_pos = pos;
67+
return true;
6468
}
6569

6670
[[nodiscard]] constexpr const value_type* data() const & noexcept

0 commit comments

Comments
 (0)