Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: runtime/vm/heap_histogram.cc

Issue 23441082: Fixed an overflow bug in the compare function used by the heap histogram sorting. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/heap_histogram.cc
===================================================================
--- runtime/vm/heap_histogram.cc (revision 27819)
+++ runtime/vm/heap_histogram.cc (working copy)
@@ -78,7 +78,12 @@
int ObjectHistogram::compare(const Element** a, const Element** b) {
- return (*b)->size_ - (*a)->size_;
+ // Be careful to return a 32bit integer.
+ intptr_t a_size = (*a)->size_;
+ intptr_t b_size = (*b)->size_;
+ if (a_size > b_size) return -1;
+ if (a_size < b_size) return 1;
+ return 0;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698