From ee8b3ecb8fed3fcf432fde9f8325503ce26bfe87 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 4 Aug 2022 00:22:41 +0200 Subject: [PATCH] Avoid using invalid addresses in ListsTestCase too This is similar to the previous commit, but done in a slightly different way to avoid changing too much of the existing code: just make "i" an alias for the first array element to ensure that "&i + 4" is a valid pointer. (cherry picked from commit f27acce6cd1164fcb0ec869cd8e7df57419c44e0) --- tests/lists/lists.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/lists/lists.cpp b/tests/lists/lists.cpp index 32d8a751e9..6714e828a9 100644 --- a/tests/lists/lists.cpp +++ b/tests/lists/lists.cpp @@ -114,7 +114,8 @@ void ListsTestCase::wxStdListTest() wxListInt list1; wxListInt::iterator it, en; wxListInt::reverse_iterator rit, ren; - int i; + int buf[4]; + int& i = buf[0]; for ( i = 0; i < 5; ++i ) list1.push_back(i + &i);