Skip to content

Commit

Permalink
ci: add ubsan check (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
spacewander authored Apr 7, 2022
1 parent b389294 commit d5291f2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
test:
runs-on: "ubuntu-18.04"
runs-on: "ubuntu-20.04"
env:
OPENRESTY_PREFIX: "/usr/local/openresty"

Expand Down Expand Up @@ -39,7 +39,7 @@ jobs:

- name: Get dependencies
run: |
sudo apt install -y cpanminus build-essential libncurses5-dev libreadline-dev libssl-dev perl luarocks
sudo apt install -y cpanminus build-essential libncurses5-dev libreadline-dev libssl-dev perl luarocks libubsan0
sudo luarocks install lua-resty-http > build.log 2>&1 || (cat build.log && exit 1)
wget https://github.com/tinygo-org/tinygo/releases/download/v0.20.0/tinygo_0.20.0_amd64.deb
Expand All @@ -55,7 +55,9 @@ jobs:
wget https://raw.githubusercontent.com/api7/apisix-build-tools/master/build-apisix-base.sh
chmod +x build-apisix-base.sh
OR_PREFIX=$OPENRESTY_PREFIX CC="clang -fsanitize=address -fcolor-diagnostics -Qunused-arguments" \
cc_opt="-Werror" ./build-apisix-base.sh latest
cc_opt="-Werror -fsanitize=undefined" \
ld_opt="-lubsan" \
./build-apisix-base.sh latest
- name: Script
run: |
Expand Down
4 changes: 4 additions & 0 deletions src/http/ngx_http_wasm_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ ngx_http_wasm_init(ngx_conf_t *cf)
}


/* To avoid complex error handling, we choose to allocate several objects together.
* The downside is that the objects are not alignment, but it is fine under x86 & ARM64, which
* are the only platforms supported by most of the Wasm VM. */
__attribute__((no_sanitize("undefined")))
void *
ngx_http_wasm_load_plugin(const char *name, size_t name_len,
const char *bytecode, size_t size)
Expand Down

0 comments on commit d5291f2

Please sign in to comment.