mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Fix array bound SEGV
.. double to int conversion rounded up and caused an array bounds segv. just added 1 to the initial resize of the array to avoid. .. annoying since I performed considerable testing of the metric histogram on Mac, but this crashed almost immediately on Linux. Bah.
This commit is contained in:
@@ -636,7 +636,7 @@ PowerHist::setData(QList<SummaryMetrics>&results, QString totalMetric, QString d
|
||||
|
||||
// how big should the array be?
|
||||
double multiplier = pow(10, m->precision());
|
||||
int max = 0, min = 0;
|
||||
double max = 0, min = 0;
|
||||
|
||||
// LOOP THRU VALUES -- REPEATED WITH CUT AND PASTE BELOW
|
||||
// SO PLEASE MAKE SAME CHANGES TWICE (SORRY)
|
||||
@@ -674,7 +674,8 @@ PowerHist::setData(QList<SummaryMetrics>&results, QString totalMetric, QString d
|
||||
|
||||
// now run thru the data again, but this time
|
||||
// populate the metricArray
|
||||
metricArray.resize(max-min);
|
||||
// we add 1 to account for possible rounding up
|
||||
metricArray.resize(1 + (int)(max)-(int)(min));
|
||||
metricArray.fill(0);
|
||||
|
||||
// LOOP THRU VALUES -- REPEATED WITH CUT AND PASTE ABOVE
|
||||
|
||||
Reference in New Issue
Block a user