Skip to content

Commit

Permalink
Add -s BINARYEN_TRAP_MODE='clamp' to prevent WASM integer overflow ex… (
Browse files Browse the repository at this point in the history
envoyproxy#61)

* Add -s BINARYEN_TRAP_MODE='clamp' to prevent WASM integer overflow exceptions.

* Add the clamp flag to the Makefile for missing_cpp.wasm
  • Loading branch information
jplevyak authored Apr 30, 2019
1 parent b1fb04c commit 1c02570
Show file tree
Hide file tree
Showing 23 changed files with 16,267 additions and 14,663 deletions.
2 changes: 1 addition & 1 deletion api/wasm/cpp/Makefile.base
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ else
endif

%.wasm %.wat: %.cc ${CPP_API}/proxy_wasm_intrinsics.h ${CPP_API}/proxy_wasm_intrinsics.js
em++ -s WASM=1 -s LEGALIZE_JS_FFI=0 -s EMIT_EMSCRIPTEN_METADATA=1 --std=c++17 -O3 -g3 -I${CPP_API} -I/usr/local/include --js-library ${CPP_API}/proxy_wasm_intrinsics.js $*.cc ${CPP_API}/proxy_wasm_intrinsics.pb.cc ${CPP_CONTEXT_LIB} ${CPP_API}/libprotobuf.bc -o $*.js
em++ -s WASM=1 -s BINARYEN_TRAP_MODE='clamp' -s LEGALIZE_JS_FFI=0 -s EMIT_EMSCRIPTEN_METADATA=1 --std=c++17 -O3 -g3 -I${CPP_API} -I/usr/local/include --js-library ${CPP_API}/proxy_wasm_intrinsics.js $*.cc ${CPP_API}/proxy_wasm_intrinsics.pb.cc ${CPP_CONTEXT_LIB} ${CPP_API}/libprotobuf.bc -o $*.js
wavm-disas $*.wasm $*.wat
wavm-compile $*.wasm $*.wasm
rm -f $*.js $*.wast
Expand Down
2 changes: 1 addition & 1 deletion api/wasm/cpp/Makefile.base_lite
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ else
endif

%.wasm %.wat: %.cc ${CPP_API}/proxy_wasm_intrinsics.h ${CPP_API}/proxy_wasm_intrinsics.js
em++ -s WASM=1 -s LEGALIZE_JS_FFI=0 -s EMIT_EMSCRIPTEN_METADATA=1 --std=c++17 -O3 -g3 -DEMSCRIPTEN_PROTOBUF_LITE=1 -I${CPP_API} -I${CPP_API}/google/protobuf -I/usr/local/include --js-library ${CPP_API}/proxy_wasm_intrinsics.js $*.cc ${CPP_API}/proxy_wasm_intrinsics_lite.pb.cc ${CPP_API}/struct_lite.pb.cc ${CPP_CONTEXT_LIB} ${CPP_API}/libprotobuf-lite.bc -o $*.js
em++ -s WASM=1 -s BINARYEN_TRAP_MODE='clamp' -s LEGALIZE_JS_FFI=0 -s EMIT_EMSCRIPTEN_METADATA=1 --std=c++17 -O3 -g3 -DEMSCRIPTEN_PROTOBUF_LITE=1 -I${CPP_API} -I${CPP_API}/google/protobuf -I/usr/local/include --js-library ${CPP_API}/proxy_wasm_intrinsics.js $*.cc ${CPP_API}/proxy_wasm_intrinsics_lite.pb.cc ${CPP_API}/struct_lite.pb.cc ${CPP_CONTEXT_LIB} ${CPP_API}/libprotobuf-lite.bc -o $*.js
wavm-disas $*.wasm $*.wat
wavm-compile $*.wasm $*.wasm
rm -f $*.js $*.wast
Expand Down
Binary file modified examples/wasm/envoy_filter_http_wasm_example.wasm
Binary file not shown.
14,883 changes: 7,619 additions & 7,264 deletions examples/wasm/envoy_filter_http_wasm_example.wat

Large diffs are not rendered by default.

Binary file modified test/extensions/access_loggers/wasm/test_data/logging.wasm
Binary file not shown.
3,492 changes: 1,841 additions & 1,651 deletions test/extensions/access_loggers/wasm/test_data/logging.wat

Large diffs are not rendered by default.

Binary file modified test/extensions/filters/http/wasm/test_data/async_call_cpp.wasm
Binary file not shown.
2,789 changes: 1,480 additions & 1,309 deletions test/extensions/filters/http/wasm/test_data/async_call_cpp.wat

Large diffs are not rendered by default.

Binary file modified test/extensions/filters/http/wasm/test_data/headers_cpp.wasm
Binary file not shown.
2,813 changes: 1,492 additions & 1,321 deletions test/extensions/filters/http/wasm/test_data/headers_cpp.wat

Large diffs are not rendered by default.

Binary file modified test/extensions/filters/http/wasm/test_data/metadata_cpp.wasm
Binary file not shown.
2,832 changes: 1,504 additions & 1,328 deletions test/extensions/filters/http/wasm/test_data/metadata_cpp.wat

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/extensions/wasm/test_data/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ include ../../../../api/wasm/cpp/Makefile.base_lite
include ../../../../api/wasm/rust/Makefile.base

missing_cpp.wasm missing_cpp.wat: missing_cpp.cc ${CPP_API}/proxy_wasm_intrinsics.h ${CPP_API}/proxy_wasm_intrinsics.js
em++ -s WASM=1 -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s LEGALIZE_JS_FFI=0 -s EMIT_EMSCRIPTEN_METADATA=1 --std=c++17 -O3 -g3 -DEMSCRIPTEN_PROTOBUF_LITE=1 -I${CPP_API} -I${CPP_API}/google/protobuf -I/usr/local/include --js-library ${CPP_API}/proxy_wasm_intrinsics.js missing_cpp.cc ${CPP_API}/proxy_wasm_intrinsics_lite.pb.cc ${CPP_API}/struct_lite.pb.cc ${CPP_CONTEXT_LIB} ${CPP_API}/libprotobuf-lite.bc -o missing_cpp.js
em++ -s WASM=1 -s BINARYEN_TRAP_MODE='clamp' -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s LEGALIZE_JS_FFI=0 -s EMIT_EMSCRIPTEN_METADATA=1 --std=c++17 -O3 -g3 -DEMSCRIPTEN_PROTOBUF_LITE=1 -I${CPP_API} -I${CPP_API}/google/protobuf -I/usr/local/include --js-library ${CPP_API}/proxy_wasm_intrinsics.js missing_cpp.cc ${CPP_API}/proxy_wasm_intrinsics_lite.pb.cc ${CPP_API}/struct_lite.pb.cc ${CPP_CONTEXT_LIB} ${CPP_API}/libprotobuf-lite.bc -o missing_cpp.js
wavm-disas missing_cpp.wasm missing_cpp.wat
wavm-compile missing_cpp.wasm missing_cpp.wasm
rm -f missing_cpp.js missing_cpp.wast
Expand Down
Binary file modified test/extensions/wasm/test_data/asm2wasm_cpp.wasm
Binary file not shown.
Loading

0 comments on commit 1c02570

Please sign in to comment.