From e33d29a5d83dfa1bdd163085ed739aef9864ebb6 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sun, 30 Dec 2018 20:33:35 +0100 Subject: [PATCH] tinyexpr: Reserve arity parameters This somehow fixes heap-buffer-overflow? I thought this was supposed to be safe. --- src/tinyexpr.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tinyexpr.cpp b/src/tinyexpr.cpp index a3c03ca21..356ed90bb 100644 --- a/src/tinyexpr.cpp +++ b/src/tinyexpr.cpp @@ -65,6 +65,8 @@ public: default: arity = 0; } + parameters.reserve(arity); + // We allow filling the parameters later. if (params) { for (int i = 0; i < arity; i++) parameters.push_back(params[i]);