mirror of
https://github.com/monero-project/monero.git
synced 2024-10-01 11:49:47 -04:00
Merge pull request #7218
353f93ee1
portable_storage: remove array element limit (moneromooo-monero)
This commit is contained in:
commit
88b7bc394e
@ -38,7 +38,6 @@
|
|||||||
#define EPEE_PORTABLE_STORAGE_RECURSION_LIMIT_INTERNAL 100
|
#define EPEE_PORTABLE_STORAGE_RECURSION_LIMIT_INTERNAL 100
|
||||||
#endif
|
#endif
|
||||||
#define EPEE_PORTABLE_STORAGE_OBJECT_LIMIT_INTERNAL 65536
|
#define EPEE_PORTABLE_STORAGE_OBJECT_LIMIT_INTERNAL 65536
|
||||||
#define EPEE_PORTABLE_STORAGE_ARRAY_ELEMENT_LIMIT_INTERNAL 65536
|
|
||||||
|
|
||||||
namespace epee
|
namespace epee
|
||||||
{
|
{
|
||||||
@ -105,7 +104,6 @@ namespace epee
|
|||||||
size_t m_count;
|
size_t m_count;
|
||||||
size_t m_recursion_count;
|
size_t m_recursion_count;
|
||||||
size_t m_objects;
|
size_t m_objects;
|
||||||
size_t m_array_elements;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline throwable_buffer_reader::throwable_buffer_reader(const void* ptr, size_t sz)
|
inline throwable_buffer_reader::throwable_buffer_reader(const void* ptr, size_t sz)
|
||||||
@ -118,7 +116,6 @@ namespace epee
|
|||||||
m_count = sz;
|
m_count = sz;
|
||||||
m_recursion_count = 0;
|
m_recursion_count = 0;
|
||||||
m_objects = 0;
|
m_objects = 0;
|
||||||
m_array_elements = 0;
|
|
||||||
}
|
}
|
||||||
inline
|
inline
|
||||||
void throwable_buffer_reader::read(void* target, size_t count)
|
void throwable_buffer_reader::read(void* target, size_t count)
|
||||||
@ -165,8 +162,6 @@ namespace epee
|
|||||||
//for pod types
|
//for pod types
|
||||||
array_entry_t<type_name> sa;
|
array_entry_t<type_name> sa;
|
||||||
size_t size = read_varint();
|
size_t size = read_varint();
|
||||||
CHECK_AND_ASSERT_THROW_MES(size < EPEE_PORTABLE_STORAGE_ARRAY_ELEMENT_LIMIT_INTERNAL - m_array_elements, "Too many array elements");
|
|
||||||
m_array_elements += size;
|
|
||||||
CHECK_AND_ASSERT_THROW_MES(size <= m_count / ps_min_bytes<type_name>::strict, "Size sanity check failed");
|
CHECK_AND_ASSERT_THROW_MES(size <= m_count / ps_min_bytes<type_name>::strict, "Size sanity check failed");
|
||||||
|
|
||||||
sa.reserve(size);
|
sa.reserve(size);
|
||||||
|
Loading…
Reference in New Issue
Block a user