mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-04 17:35:42 +02:00
Merge pull request #337 from mapbox/sanitize-integer
Fix integer overflow identified by -fsanitize=integer
This commit is contained in:
+2
-2
@@ -1376,8 +1376,8 @@ drawvec stairstep(drawvec &geom, int z, int detail) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < out.size(); i++) {
|
for (size_t i = 0; i < out.size(); i++) {
|
||||||
out[i].x <<= (32 - detail - z);
|
out[i].x *= 1 << (32 - detail - z);
|
||||||
out[i].y <<= (32 - detail - z);
|
out[i].y *= 1 << (32 - detail - z);
|
||||||
}
|
}
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
|
|||||||
@@ -726,12 +726,12 @@ bool find_common_edges(std::vector<partial> &partials, int z, int line_detail, d
|
|||||||
|
|
||||||
if (s > 0) {
|
if (s > 0) {
|
||||||
drawvec left;
|
drawvec left;
|
||||||
if (g[a + (0 - 1 + s) % s] < g[a + 0]) {
|
if (g[a + (s - 1) % s] < g[a]) {
|
||||||
left.push_back(g[a + (0 - 1 + s) % s]);
|
left.push_back(g[a + (s - 1) % s]);
|
||||||
left.push_back(g[a + 0]);
|
left.push_back(g[a]);
|
||||||
} else {
|
} else {
|
||||||
left.push_back(g[a + 0]);
|
left.push_back(g[a]);
|
||||||
left.push_back(g[a + (0 - 1 + s) % s]);
|
left.push_back(g[a + (s - 1) % s]);
|
||||||
}
|
}
|
||||||
if (left[1] < left[0]) {
|
if (left[1] < left[0]) {
|
||||||
fprintf(stderr, "left misordered\n");
|
fprintf(stderr, "left misordered\n");
|
||||||
@@ -878,8 +878,8 @@ bool find_common_edges(std::vector<partial> &partials, int z, int line_detail, d
|
|||||||
partials[i].arc_polygon.push_back(added);
|
partials[i].arc_polygon.push_back(added);
|
||||||
merge_candidates.insert(std::pair<ssize_t, size_t>(added, i));
|
merge_candidates.insert(std::pair<ssize_t, size_t>(added, i));
|
||||||
} else {
|
} else {
|
||||||
partials[i].arc_polygon.push_back(-f2->second);
|
partials[i].arc_polygon.push_back(-(ssize_t) f2->second);
|
||||||
merge_candidates.insert(std::pair<ssize_t, size_t>(-f2->second, i));
|
merge_candidates.insert(std::pair<ssize_t, size_t>(-(ssize_t) f2->second, i));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
partials[i].arc_polygon.push_back(f->second);
|
partials[i].arc_polygon.push_back(f->second);
|
||||||
|
|||||||
Reference in New Issue
Block a user