Skip to content
Snippets Groups Projects
Unverified Commit 73c57edb authored by Brian Carrier's avatar Brian Carrier Committed by GitHub
Browse files

Merge pull request #2774 from APriestman/fixAPFSboundChecks

Fix bound check on key_data
parents 1bee5464 58c8b602
No related branches found
No related tags found
No related merge requests found
......@@ -142,7 +142,7 @@ class APFSBtreeNodeIterator {
const auto &t = _node->_table_data.toc.variable[_index];
const auto key_data = _node->_table_data.koff + t.key_offset;
const auto val_data = _node->_table_data.voff - t.val_offset;
if (key_data > _node->_storage.data()) {
if (key_data > _node->_storage.data() + _node->_storage.size()) {
throw std::runtime_error("init_value: invalid key_offset");
}
if (val_data < _node->_storage.data()) {
......@@ -174,7 +174,7 @@ class APFSBtreeNodeIterator {
const auto &t = _node->_table_data.toc.fixed[_index];
const auto key_data = _node->_table_data.koff + t.key_offset;
const auto val_data = _node->_table_data.voff - t.val_offset;
if (key_data > _node->_storage.data()) {
if (key_data > _node->_storage.data() + _node->_storage.size()) {
throw std::runtime_error("init_value: invalid key_offset");
}
if (val_data < _node->_storage.data()) {
......@@ -1166,7 +1166,7 @@ inline void APFSBtreeNodeIterator<APFSJObjBtreeNode>::init_value<void>(int recur
const auto &t = _node->_table_data.toc.variable[_index];
const auto key_data = _node->_table_data.koff + t.key_offset;
const auto val_data = _node->_table_data.voff - t.val_offset;
if (key_data > _node->_storage.data()) {
if (key_data > _node->_storage.data() + _node->_storage.size()) {
throw std::runtime_error("APFSBtreeNodeIterator<APFSJObjBtreeNode>::init_value: invalid key_offset");
}
if (val_data < _node->_storage.data()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment