summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-07-06 17:09:51 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-07-06 17:09:51 +0200
commit7a3569f80051d48ac427849c30b2f5685b368b71 (patch)
tree20f02a2bcc02dabe5e7c86306c429be8a55d23ad /tracker-pt
parentc2aef72fd640298b0e947e858d0f5a294854f852 (diff)
tracker/pt: fix out-of-bounds write
The input array has exactly 3 points. The vector has potentially more points, sorted by circularity. Spotted-by: @DaMichel Closes #380
Diffstat (limited to 'tracker-pt')
-rw-r--r--tracker-pt/point_tracker.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/tracker-pt/point_tracker.cpp b/tracker-pt/point_tracker.cpp
index 1fb4128e..51f10470 100644
--- a/tracker-pt/point_tracker.cpp
+++ b/tracker-pt/point_tracker.cpp
@@ -37,7 +37,7 @@ void PointModel::get_d_order(const std::vector<cv::Vec2f>& points, int d_order[]
// fit line to orthographically projected points
std::vector<std::pair<float,int>> d_vals;
// get sort indices with respect to d scalar product
- for (unsigned i = 0; i<points.size(); ++i)
+ for (unsigned i = 0; i < PointModel::N_POINTS; ++i)
d_vals.push_back(std::pair<float, int>(d.dot(points[i]), i));
std::sort(d_vals.begin(),
@@ -45,7 +45,7 @@ void PointModel::get_d_order(const std::vector<cv::Vec2f>& points, int d_order[]
d_vals_sort
);
- for (unsigned i = 0; i<points.size(); ++i)
+ for (unsigned i = 0; i < PointModel::N_POINTS; ++i)
d_order[i] = d_vals[i].second;
}