mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/shared] CurveView: add an assertion on the number of labels to
avoid reading out of bound memory
This commit is contained in:
committed by
LeaNumworks
parent
2ff0b789f9
commit
f6cfcab4e5
@@ -167,7 +167,9 @@ int CurveView::numberOfLabels(Axis axis) const {
|
||||
float labelStep = 2.0f * gridUnit(axis);
|
||||
float minLabel = std::ceil(min(axis)/labelStep);
|
||||
float maxLabel = std::floor(max(axis)/labelStep);
|
||||
return maxLabel - minLabel + 1;
|
||||
int numberOfLabels = maxLabel - minLabel + 1;
|
||||
assert(numberOfLabels <= (axis == Axis::Horizontal ? k_maxNumberOfXLabels : k_maxNumberOfYLabels));
|
||||
return numberOfLabels;
|
||||
}
|
||||
|
||||
void CurveView::computeLabels(Axis axis) {
|
||||
|
||||
Reference in New Issue
Block a user