summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt3
-rw-r--r--src/binary-reader-linker.cc2
-rw-r--r--src/common.h9
-rw-r--r--src/tools/spectest-interp.cc2
-rw-r--r--src/tools/wasm-interp.cc2
-rw-r--r--src/tools/wasm-objdump.cc2
-rw-r--r--src/tools/wasm-opcodecnt.cc2
-rw-r--r--src/tools/wasm-validate.cc2
-rw-r--r--src/tools/wasm2wat.cc2
-rw-r--r--ubsan.blacklist9
10 files changed, 17 insertions, 18 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ba94e526..ee6d6daf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -180,7 +180,8 @@ SANITIZER(USE_LSAN "-fsanitize=leak")
if (USE_UBSAN)
# -fno-sanitize-recover was deprecated, see if we are compiling with a newer
# clang that requires -fno-sanitize-recover=all.
- include(CheckCCompilerFlag)
+ set(UBSAN_BLACKLIST ${WABT_SOURCE_DIR}/ubsan.blacklist)
+ include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-fsanitize=undefined -fno-sanitize-recover -Wall -Werror" HAS_UBSAN_RECOVER_BARE)
if (HAS_UBSAN_RECOVER_BARE)
SANITIZER(USE_UBSAN "-fsanitize=undefined -fno-sanitize-recover -fsanitize-blacklist=${UBSAN_BLACKLIST}")
diff --git a/src/binary-reader-linker.cc b/src/binary-reader-linker.cc
index aab17f1a..0af95304 100644
--- a/src/binary-reader-linker.cc
+++ b/src/binary-reader-linker.cc
@@ -289,7 +289,7 @@ Result ReadBinaryLinker(LinkerInputBinary* input_info, LinkOptions* options) {
ReadBinaryOptions read_options;
read_options.read_debug_names = true;
read_options.log_stream = options->log_stream;
- return ReadBinary(DataOrNull(input_info->data), input_info->data.size(),
+ return ReadBinary(input_info->data.data(), input_info->data.size(),
&reader, &read_options);
}
diff --git a/src/common.h b/src/common.h
index 1709e506..342316b2 100644
--- a/src/common.h
+++ b/src/common.h
@@ -126,15 +126,6 @@ void Destruct(T& placement) {
placement.~T();
}
-// Calls data() on vector, string, etc. but will return nullptr if the
-// container is empty.
-// TODO(binji): this should probably be removed when there is a more direct way
-// to represent a memory slice (e.g. something similar to GSL's span)
-template <typename T>
-typename T::value_type* DataOrNull(T& container) {
- return container.empty() ? nullptr : container.data();
-}
-
inline std::string WABT_PRINTF_FORMAT(1, 2)
StringPrintf(const char* format, ...) {
va_list args;
diff --git a/src/tools/spectest-interp.cc b/src/tools/spectest-interp.cc
index 8779f44f..c461b827 100644
--- a/src/tools/spectest-interp.cc
+++ b/src/tools/spectest-interp.cc
@@ -1081,7 +1081,7 @@ static wabt::Result ReadModule(const char* module_filename,
const bool kStopOnFirstError = true;
ReadBinaryOptions options(s_features, s_log_stream.get(), kReadDebugNames,
kStopOnFirstError);
- result = ReadBinaryInterp(env, DataOrNull(file_data), file_data.size(),
+ result = ReadBinaryInterp(env, file_data.data(), file_data.size(),
&options, error_handler, out_module);
if (Succeeded(result)) {
diff --git a/src/tools/wasm-interp.cc b/src/tools/wasm-interp.cc
index 82b455e0..0503e621 100644
--- a/src/tools/wasm-interp.cc
+++ b/src/tools/wasm-interp.cc
@@ -141,7 +141,7 @@ static wabt::Result ReadModule(const char* module_filename,
const bool kStopOnFirstError = true;
ReadBinaryOptions options(s_features, s_log_stream.get(), kReadDebugNames,
kStopOnFirstError);
- result = ReadBinaryInterp(env, DataOrNull(file_data), file_data.size(),
+ result = ReadBinaryInterp(env, file_data.data(), file_data.size(),
&options, error_handler, out_module);
if (Succeeded(result)) {
diff --git a/src/tools/wasm-objdump.cc b/src/tools/wasm-objdump.cc
index c8c8e7ad..28a059d7 100644
--- a/src/tools/wasm-objdump.cc
+++ b/src/tools/wasm-objdump.cc
@@ -72,7 +72,7 @@ Result dump_file(const char* filename) {
std::vector<uint8_t> file_data;
CHECK_RESULT(ReadFile(filename, &file_data));
- uint8_t* data = DataOrNull(file_data);
+ uint8_t* data = file_data.data();
size_t size = file_data.size();
// Perform serveral passed over the binary in order to print out different
diff --git a/src/tools/wasm-opcodecnt.cc b/src/tools/wasm-opcodecnt.cc
index fcd9d2fa..fd01f62b 100644
--- a/src/tools/wasm-opcodecnt.cc
+++ b/src/tools/wasm-opcodecnt.cc
@@ -158,7 +158,7 @@ int ProgramMain(int argc, char** argv) {
if (Succeeded(result)) {
OpcodeInfoCounts counts;
- result = ReadBinaryOpcnt(DataOrNull(file_data), file_data.size(),
+ result = ReadBinaryOpcnt(file_data.data(), file_data.size(),
&s_read_binary_options, &counts);
if (Succeeded(result)) {
stream.Writef("Opcode counts:\n");
diff --git a/src/tools/wasm-validate.cc b/src/tools/wasm-validate.cc
index 919d0bf4..761d3c16 100644
--- a/src/tools/wasm-validate.cc
+++ b/src/tools/wasm-validate.cc
@@ -77,7 +77,7 @@ int ProgramMain(int argc, char** argv) {
const bool kStopOnFirstError = true;
ReadBinaryOptions options(s_features, s_log_stream.get(),
s_read_debug_names, kStopOnFirstError);
- result = ReadBinaryIr(s_infile.c_str(), DataOrNull(file_data),
+ result = ReadBinaryIr(s_infile.c_str(), file_data.data(),
file_data.size(), &options, &error_handler, &module);
if (Succeeded(result)) {
WastLexer* lexer = nullptr;
diff --git a/src/tools/wasm2wat.cc b/src/tools/wasm2wat.cc
index a0105bbf..11f401c8 100644
--- a/src/tools/wasm2wat.cc
+++ b/src/tools/wasm2wat.cc
@@ -106,7 +106,7 @@ int ProgramMain(int argc, char** argv) {
const bool kStopOnFirstError = true;
ReadBinaryOptions options(s_features, s_log_stream.get(),
s_read_debug_names, kStopOnFirstError);
- result = ReadBinaryIr(s_infile.c_str(), DataOrNull(file_data),
+ result = ReadBinaryIr(s_infile.c_str(), file_data.data(),
file_data.size(), &options, &error_handler, &module);
if (Succeeded(result)) {
if (Succeeded(result) && s_validate) {
diff --git a/ubsan.blacklist b/ubsan.blacklist
index f0aeaea7..5ac9d3c9 100644
--- a/ubsan.blacklist
+++ b/ubsan.blacklist
@@ -1,5 +1,12 @@
# Work around libstdc++ bug: https://llvm.org/bugs/show_bug.cgi?id=18156
# Also see: http://lists.llvm.org/pipermail/cfe-dev/2015-January/040945.html
src:*/ios_base.h
-# Work around another libstdc++ bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60734
+
+# Work around another libstdc++ bug:
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60734
src:*/stl_tree.h
+
+# Work around for libstdc++ 4.8 bug:
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59829
+src:*/stl_vector.h
+src:*/stl_iterator.h