-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix integer overflows in pool::ordered_malloc (#42)
Fixes trac #6701 (https://svn.boost.org/trac10/ticket/6701). Originally-by: Jonathan Wakely <jwakely.boost@kayari.org>
- Loading branch information
Showing
5 changed files
with
58 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
no_fishy_value | ||
Memcheck:FishyValue | ||
__builtin_vec_new(size) | ||
fun:_ZnamRKSt9nothrow_t | ||
... | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* Copyright (C) 2012 Étienne Dupuis | ||
* | ||
* Use, modification and distribution is subject to the | ||
* Boost Software License, Version 1.0. (See accompanying | ||
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) | ||
*/ | ||
|
||
// Test of bug #6701 (https://svn.boost.org/trac/boost/ticket/6701) | ||
|
||
#include <boost/pool/object_pool.hpp> | ||
#include <boost/limits.hpp> | ||
|
||
int main() | ||
{ | ||
boost::pool<> p(1024, std::numeric_limits<size_t>::max() / 768); | ||
|
||
void *x = p.malloc(); | ||
BOOST_ASSERT(!x); | ||
|
||
BOOST_ASSERT(std::numeric_limits<size_t>::max() / 1024 >= p.get_next_size()); | ||
BOOST_ASSERT(std::numeric_limits<size_t>::max() / 1024 >= p.get_max_size()); | ||
|
||
void *y = p.ordered_malloc(std::numeric_limits<size_t>::max() / 768); | ||
BOOST_ASSERT(!y); | ||
|
||
return 0; | ||
} |