https://bugs.kde.org/show_bug.cgi?id=427510

--- Comment #3 from Ulya Trofimovich <skvad...@gmail.com> ---
The "uninitilized" error is simple: the code assumes nonempty array and sets
its first element (in the case of a zero-sized array it adds one element, which
causes the second error because the assumption that there is an even number of
elements in the array is broken). The following simple patch fixes the error:

diff --git a/callgrind/callgrind_annotate.in b/callgrind/callgrind_annotate.in
index 4f28129..42a8cd1 100644
--- a/callgrind/callgrind_annotate.in
+++ b/callgrind/callgrind_annotate.in
@@ -1136,7 +1136,9 @@ sub annotate_ann_files($)
             }

             # Annotate chosen lines, tracking total counts of lines printed
-            $pairs[0] = 1 if ($pairs[0] < 1);
+            if ($n > 0 && $pairs[0] < 1) {
+                $pairs[0] = 1
+            }
             while (@pairs) {
                 my $low  = shift @pairs;
                 my $high = shift @pairs;

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to