[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
This commit is contained in:
zmiao
2020-04-07 16:30:30 +03:00
committed by GitHub
parent 8986b558eb
commit bf4c7340f3
21 changed files with 110 additions and 51 deletions

28
scripts/ubsan.blacklist Normal file
View File

@@ -0,0 +1,28 @@
#############################################################################
# Ignore system libraries.
src:*/usr/*
#############################################################################
# Mostly hash functions where integer overflow is OK.
src:*/mbgl/util/hash.hpp
#############################################################################
# vendor libs
# unsigned integer overflow: unsigned interger index in for loop
src:*/vendor/earcut.hpp/include/mapbox/earcut.hpp
# unsigned integer overflow: hash function: str_hash
src:*/vendor/eternal/*/eternal.hpp
# unsigned integer overflow
src:*/vendor/*/rapidjson/reader.h
# division by zero: ill usage of test data in 'render-tests/filter/in', latitude shouldn't be +/-90
src:*/vendor/*/geojsonvt/convert.hpp
# Boost bug: Implicit conversion
src:*/include/boost/locale/utf.hpp
# Boost bug: unsigned integer overflow
src:*/include/boost/crc.hpp