From 3502d2fbc827a16cc27bae286c2599992e181e28 Mon Sep 17 00:00:00 2001 From: Stijn Duynslaeger Date: Fri, 16 Sep 2022 16:03:07 +0100 Subject: [PATCH] Use unsigned int for callCount and costs to avoid integer overflow --- library/preprocessor.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/library/preprocessor.cpp b/library/preprocessor.cpp index cc8494c..b934455 100644 --- a/library/preprocessor.cpp +++ b/library/preprocessor.cpp @@ -46,7 +46,7 @@ struct ProxyData { - ProxyData(int _calledIndex, int _lnr, int _cost) : + ProxyData(int _calledIndex, int _lnr, unsigned int _cost) : calledIndex(_calledIndex), lnr(_lnr), cost(_cost) {} @@ -63,8 +63,8 @@ struct CallData int functionNr; int line; - int callCount; - int summedCallCost; + unsigned int callCount; + unsigned int summedCallCost; }; inline CallData& insertGetOrderedMap(int functionNr, int line, std::map& keyMap, std::vector& data) @@ -81,7 +81,7 @@ inline CallData& insertGetOrderedMap(int functionNr, int line, std::map calledFromInformation; std::vector subCallInformation; @@ -142,7 +142,7 @@ class Webgrind_Preprocessor std::string line; std::string buffer; int lnr; - int cost; + unsigned int cost; int funcIndex; // Read information into memory