mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-02-02 01:08:14 +00:00
Merge pull request #337 from mapbox/sanitize-integer
Fix integer overflow identified by -fsanitize=integer
This commit is contained in:
commit
3e4fcd22ec
@ -1376,8 +1376,8 @@ drawvec stairstep(drawvec &geom, int z, int detail) {
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < out.size(); i++) {
|
||||
out[i].x <<= (32 - detail - z);
|
||||
out[i].y <<= (32 - detail - z);
|
||||
out[i].x *= 1 << (32 - detail - z);
|
||||
out[i].y *= 1 << (32 - detail - z);
|
||||
}
|
||||
|
||||
return out;
|
||||
|
14
tile.cpp
14
tile.cpp
@ -726,12 +726,12 @@ bool find_common_edges(std::vector<partial> &partials, int z, int line_detail, d
|
||||
|
||||
if (s > 0) {
|
||||
drawvec left;
|
||||
if (g[a + (0 - 1 + s) % s] < g[a + 0]) {
|
||||
left.push_back(g[a + (0 - 1 + s) % s]);
|
||||
left.push_back(g[a + 0]);
|
||||
if (g[a + (s - 1) % s] < g[a]) {
|
||||
left.push_back(g[a + (s - 1) % s]);
|
||||
left.push_back(g[a]);
|
||||
} else {
|
||||
left.push_back(g[a + 0]);
|
||||
left.push_back(g[a + (0 - 1 + s) % s]);
|
||||
left.push_back(g[a]);
|
||||
left.push_back(g[a + (s - 1) % s]);
|
||||
}
|
||||
if (left[1] < left[0]) {
|
||||
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);
|
||||
merge_candidates.insert(std::pair<ssize_t, size_t>(added, i));
|
||||
} else {
|
||||
partials[i].arc_polygon.push_back(-f2->second);
|
||||
merge_candidates.insert(std::pair<ssize_t, size_t>(-f2->second, i));
|
||||
partials[i].arc_polygon.push_back(-(ssize_t) f2->second);
|
||||
merge_candidates.insert(std::pair<ssize_t, size_t>(-(ssize_t) f2->second, i));
|
||||
}
|
||||
} else {
|
||||
partials[i].arc_polygon.push_back(f->second);
|
||||
|
Loading…
x
Reference in New Issue
Block a user