From 41f921cfd7c7f510a84d33679f108f744affd5f5 Mon Sep 17 00:00:00 2001 From: Samoylov Dmitry Date: Sun, 9 Apr 2017 14:02:56 +0700 Subject: [PATCH] Make erase UB less critical --- task01/dsam.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/task01/dsam.h b/task01/dsam.h index bf77ab6..348c57d 100644 --- a/task01/dsam.h +++ b/task01/dsam.h @@ -64,6 +64,9 @@ template class myvector { { assert(index >= 0); assert(index < used); + + if (index < 0 || index >= used) + return; if (data == data_on_stack || index > used / 4) {