summaryrefslogtreecommitdiff
path: root/src/mbgl/geometry
diff options
context:
space:
mode:
authorzmiao <miao.zhao@mapbox.com>2020-04-07 16:30:30 +0300
committerGitHub <noreply@github.com>2020-04-07 16:30:30 +0300
commitbf4c7340f32c1e673e6a37b91fc65305757f52d1 (patch)
treec7871ff8901617b09d8a8d45b57334c2198b9b99 /src/mbgl/geometry
parent8986b558eb92e431c773b6033d8ae271eb71de00 (diff)
downloadqtlocation-mapboxgl-bf4c7340f32c1e673e6a37b91fc65305757f52d1.tar.gz
[build] Fix undefined behavour sanitizer (#16375)
* [build] Fix integer overflow runtime error for core part Temporarily remove circle ci UBSAN build precondition * [build] Enable all of the ubsans [build] Check runtime error [build] Update UBSAN_OPTION * [build] Add UBSAN blacklist [build] Ignore system libraries [build] Ignore vendor library * [build] Fix implicit conversion runtime error in core * [build] Fix division by zero runtime error * [build] Add unfixed error to ubsan blacklist * [build] Make UBSAN halt on error Revert "Temporary remove build precondition" * [build] Fix division by zero error * [build] Make UBSAN officially work without FIXME prefix * [build] Fix implicit conversion from int64_t to uint64_t * [build] Rename style test json file name * Address review findings
Diffstat (limited to 'src/mbgl/geometry')
-rw-r--r--src/mbgl/geometry/line_atlas.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mbgl/geometry/line_atlas.cpp b/src/mbgl/geometry/line_atlas.cpp
index 6ddf16af0b..2042195b6c 100644
--- a/src/mbgl/geometry/line_atlas.cpp
+++ b/src/mbgl/geometry/line_atlas.cpp
@@ -54,13 +54,17 @@ void addRoundDash(
if (ranges.empty()) return;
for (int y = -n; y <= n; y++) {
- int row = yOffset + n + y;
+ int row = static_cast<int32_t>(yOffset) + n + y;
const uint32_t index = image.size.width * row;
uint32_t currIndex = 0;
DashRange range = ranges[currIndex];
for (uint32_t x = 0; x < image.size.width; ++x) {
- if (x / range.right > 1.0f && ++currIndex < ranges.size()) {
+ if (range.right == 0) {
+ if (x != 0 && ++currIndex < ranges.size()) {
+ range = ranges[currIndex];
+ }
+ } else if (x / range.right > 1.0f && ++currIndex < ranges.size()) {
range = ranges[currIndex];
}