From: Petr Machata Date: Thu, 26 Aug 2010 00:32:47 +0000 (+0200) Subject: Fix SEGV in --verbose mode X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=305841f1e4664347cd7d55487e91547a4535ec7b;p=thirdparty%2Felfutils.git Fix SEGV in --verbose mode --- diff --git a/dwarflint/messages.cc b/dwarflint/messages.cc index 1dba92e79..fa89f8260 100644 --- a/dwarflint/messages.cc +++ b/dwarflint/messages.cc @@ -31,7 +31,13 @@ namespace { cat_to_str () { -#define MC(CAT, ID) {reserve (ID); (*this)[ID] = #CAT;} + int count = 0; +#define MC(CAT, ID) if (ID > count) count = ID; + MESSAGE_CATEGORIES +#undef MC + + resize (count + 1); +#define MC(CAT, ID) (*this)[ID] = #CAT; MESSAGE_CATEGORIES #undef MC }