mirror of https://github.com/PentHertz/srsLTE.git
lib,asn1_utils: fix out of bounds access on zero-sized array
* fix error: ... offset 0 is out of the bounds [0, 0] [-Werror=array-bounds] * fix note: destination object of size 0 allocated by ‘operator new []’ --> data_ = new T[cap_];
This commit is contained in:
parent
58f71b10b6
commit
0c9ba5b87e
|
@ -193,8 +193,12 @@ public:
|
|||
{
|
||||
size_ = nof_items;
|
||||
cap_ = nof_items;
|
||||
data_ = new T[cap_];
|
||||
std::copy(ptr, ptr + size_, data_);
|
||||
if (ptr != NULL) {
|
||||
data_ = new T[cap_];
|
||||
std::copy(ptr, ptr + size_, data_);
|
||||
} else {
|
||||
data_ = NULL;
|
||||
}
|
||||
}
|
||||
~dyn_array()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue