Skip to content

Commit

Permalink
Fix possible out-of-bounds exception in HeatMapSeries HitTest (#1524)
Browse files Browse the repository at this point in the history
  • Loading branch information
VisualMelon committed Apr 30, 2020
1 parent d9bc9a2 commit 458de6a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ All notable changes to this project will be documented in this file.
- Custom tracker strings can cause exception in histogram chart (#1455)
- OxyPlot.WindowsForms package description (#1457)
- NullReference in VolumeSeries if no data in Items list (#1491)
- Possible out-of-bounds exception in HeatMapSeries HitTest (#1524)

## [2.0.0] - 2019-10-19
### Added
Expand Down
6 changes: 6 additions & 0 deletions Source/OxyPlot/Series/HeatMapSeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,12 @@ public override TrackerHitResult GetNearestPoint(ScreenPoint point, bool interpo
point = this.Transform(p);
}

// perform a second range check in index space to accomodate rounding
if (i < -0.5 || i > this.Data.GetLength(0) - 0.5 || j < -0.5 || j > this.Data.GetLength(1) - 0.5)
{
return null;
}

var value = GetValue(this.Data, i, j);
var colorAxis = this.ColorAxis as Axis;
var colorAxisTitle = (colorAxis != null ? colorAxis.Title : null) ?? DefaultColorAxisTitle;
Expand Down

0 comments on commit 458de6a

Please sign in to comment.