update memory to check for size bounds:
parent
1a72728aeb
commit
a555b53a61
|
@ -11,6 +11,7 @@
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "queue.h"
|
#include "queue.h"
|
||||||
|
#include <blt/std/assert.h>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -179,7 +180,11 @@ namespace blt
|
||||||
|
|
||||||
explicit scoped_buffer(size_t size): _size(size)
|
explicit scoped_buffer(size_t size): _size(size)
|
||||||
{
|
{
|
||||||
_buffer = new T[size];
|
BLT_ASSERT(size >= 0);
|
||||||
|
if (size > 0)
|
||||||
|
_buffer = new T[size];
|
||||||
|
else
|
||||||
|
_buffer = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_buffer(const scoped_buffer& copy)
|
scoped_buffer(const scoped_buffer& copy)
|
||||||
|
|
Loading…
Reference in New Issue