From 88b7bed20f4373053cf28e3207703ceddf0d9ea4 Mon Sep 17 00:00:00 2001 From: cutealien Date: Wed, 21 Sep 2022 20:09:28 +0000 Subject: [PATCH] Merging r6286 through r6421 from branch releases/1.8 to trunk git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6422 dfc29bdd-3216-0410-991c-e03cc46cb475 --- changes.txt | 1 + examples/04.Movement/main.cpp | 14 +++++++------- include/irrString.h | 6 +++--- tests/tests-last-passed-at.txt | 8 ++++---- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/changes.txt b/changes.txt index 5648e352..fb7e5979 100644 --- a/changes.txt +++ b/changes.txt @@ -374,6 +374,7 @@ Changes in 1.9 (not yet released) -------------------------- Changes in 1.8.6 +- Avoid warning about stringop-overflow in string::subString when compiling in release with newer gcc - Update library zlib to 1.2.11 (from 1.2.8) - Update library bzip2 to 1.0.8 (from 1.0.6) - Security: Fix buffer overflow caused by malformed md2 files. Thanks @procfs for reporting (https://irrlicht.sourceforge.io/forum/viewtopic.php?f=7&t=52785) diff --git a/examples/04.Movement/main.cpp b/examples/04.Movement/main.cpp index e7d37776..6a3c94b0 100644 --- a/examples/04.Movement/main.cpp +++ b/examples/04.Movement/main.cpp @@ -42,7 +42,7 @@ public: /* Always return false by default. If you return true you tell the engine that you handled this event completely and the Irrlicht should not - process it any further. So for example if you return true for all + process it any further. So for example if you return true for all EET_KEY_INPUT_EVENT events then Irrlicht would not pass on key-events to it's GUI system. */ @@ -54,7 +54,7 @@ public: { return KeyIsDown[keyCode]; } - + MyEventReceiver() { for (u32 i=0; i(10,20)); /* - Lets draw the scene and also write the current frames per second and the + Lets draw the scene and also write the current frames per second and the name of the driver to the caption of the window. */ int lastFPS = -1; @@ -259,7 +259,7 @@ int main() In the end, delete the Irrlicht device. */ device->drop(); - + return 0; } diff --git a/include/irrString.h b/include/irrString.h index 021086f6..bc7a6a23 100644 --- a/include/irrString.h +++ b/include/irrString.h @@ -947,13 +947,13 @@ public: \param make_lower copy only lower case */ string subString(u32 begin, s32 length, bool make_lower = false ) const { + // clamp length to maximal value + if ((length+begin) > size()) + length = size()-begin; // if start after string // or no proper substring length if ((length <= 0) || (begin>=size())) return string(""); - // clamp length to maximal value - if ((length+begin) > size()) - length = size()-begin; string o; o.reserve(length+1); diff --git a/tests/tests-last-passed-at.txt b/tests/tests-last-passed-at.txt index 3cde178b..fde0c2e8 100644 --- a/tests/tests-last-passed-at.txt +++ b/tests/tests-last-passed-at.txt @@ -1,4 +1,4 @@ -Tests finished. 72 tests of 72 passed. -Compiled as DEBUG -Test suite pass at GMT Sat May 14 18:16:57 2022 - +Tests finished. 72 tests of 72 passed. +Compiled as DEBUG +Test suite pass at GMT Thu Sep 15 20:10:06 2022 +