mirror of
https://github.com/Zygo/bees.git
synced 2025-05-17 05:15:45 +02:00
fs: remove buffer overrun check in get_struct_ptr for non-copying containers
When we are using non-copying containers, we can't call resize() on them. get_struct_ptr is essentially a pointer cast, so we will end up with a pointer to a struct that extends beyond the boundaries of the container. As long as the btrfs metadata is not corrupted, we should not have too many problems. Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
parent
f45e379802
commit
9ca69bb7ff
@ -205,10 +205,10 @@ namespace crucible {
|
||||
get_struct_ptr(const V &v, size_t offset = 0)
|
||||
{
|
||||
// OK so sometimes btrfs overshoots a little
|
||||
if (offset + sizeof(T) > v.size()) {
|
||||
v.resize(offset + sizeof(T), 0);
|
||||
}
|
||||
THROW_CHECK2(invalid_argument, v.size(), offset + sizeof(T), offset + sizeof(T) <= v.size());
|
||||
// if (offset + sizeof(T) > v.size()) {
|
||||
// v.resize(offset + sizeof(T), 0);
|
||||
// }
|
||||
// THROW_CHECK2(invalid_argument, v.size(), offset + sizeof(T), offset + sizeof(T) <= v.size());
|
||||
return reinterpret_cast<const T*>(v.data() + offset);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user