]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Fix SEGV in --verbose mode
authorPetr Machata <pmachata@redhat.com>
Thu, 26 Aug 2010 00:32:47 +0000 (02:32 +0200)
committerPetr Machata <pmachata@redhat.com>
Thu, 26 Aug 2010 00:32:47 +0000 (02:32 +0200)
dwarflint/messages.cc

index 1dba92e7980f807a37200a0ba23a866818edb57d..fa89f8260ef0955accf63f9601497e2c5da53666 100644 (file)
@@ -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
     }