From 05fbca43d11cee31e81a52035b7484c31dbab691 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Tue, 29 Jun 2021 14:46:52 +0100 Subject: [PATCH] Fix GCC 11 warning in dyn_array --- lib/include/srsran/asn1/asn1_utils.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/include/srsran/asn1/asn1_utils.h b/lib/include/srsran/asn1/asn1_utils.h index 0361359e9..f86f7eee1 100644 --- a/lib/include/srsran/asn1/asn1_utils.h +++ b/lib/include/srsran/asn1/asn1_utils.h @@ -227,11 +227,13 @@ public: size_ = new_size; return; } + T* old_data = data_; cap_ = new_size > new_cap ? new_size : new_cap; if (cap_ > 0) { data_ = new T[cap_]; if (old_data != NULL) { + srsran_assert(cap_ > size_, "Old size larger than new capacity in dyn_array\n"); std::copy(&old_data[0], &old_data[size_], data_); } } else {