forked from pool/boost
Accepting request 1230767 from home:aschnell:boost2
- update to 1.87.0 OBS-URL: https://build.opensuse.org/request/show/1230767 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/boost?expand=0&rev=333
This commit is contained in:
36
boost-pool_check_overflow.patch
Normal file
36
boost-pool_check_overflow.patch
Normal file
@@ -0,0 +1,36 @@
|
||||
Upstream URL: https://svn.boost.org/trac/boost/ticket/6701
|
||||
|
||||
Check that request size doesn't overflow.
|
||||
|
||||
Index: boost/pool/pool.hpp
|
||||
===================================================================
|
||||
--- boost/pool/pool.hpp.orig
|
||||
+++ boost/pool/pool.hpp
|
||||
@@ -10,6 +10,8 @@
|
||||
#define BOOST_POOL_HPP
|
||||
|
||||
#include <boost/config.hpp> // for workarounds
|
||||
+// std::numeric_limits
|
||||
+#include <boost/limits.hpp>
|
||||
|
||||
// std::less, std::less_equal, std::greater
|
||||
#include <functional>
|
||||
@@ -806,6 +808,9 @@ void * pool<UserAllocator>::ordered_mall
|
||||
if (n > max_chunks())
|
||||
return 0;
|
||||
|
||||
+ if (requested_size && (n > (std::numeric_limits<size_type>::max)() / requested_size))
|
||||
+ return 0;
|
||||
+
|
||||
const size_type partition_size = alloc_size();
|
||||
const size_type total_req_size = n * requested_size;
|
||||
const size_type num_chunks = total_req_size / partition_size +
|
||||
@@ -988,6 +993,8 @@ public:
|
||||
{
|
||||
if(max_alloc_size && (n > max_alloc_size))
|
||||
return 0;
|
||||
+ if(chunk_size && (n > (std::numeric_limits<size_type>::max)() / chunk_size))
|
||||
+ return 0;
|
||||
void* ret = (user_allocator::malloc)(chunk_size * n);
|
||||
used_list.insert(ret);
|
||||
return ret;
|
||||
Reference in New Issue
Block a user