Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass -fno-sanitize-recover=all to make all UBSan detections fatal #698

Merged
merged 3 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
with:
submodules: recursive
- name: Build
run: CMAKE_OPTIONS="-DCMAKE_C_FLAGS=-fsanitize=address,undefined" make
run: CMAKE_OPTIONS="-DCMAKE_C_FLAGS='-fsanitize=address,undefined -fno-sanitize-recover=all'" make
- name: Test
run: make test
- name: Test with Aggressive GC
Expand Down
7 changes: 4 additions & 3 deletions src/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,19 @@ static int luv_tcp_bind(lua_State* L) {
static void parse_sockaddr(lua_State* L, struct sockaddr_storage* address) {
char ip[INET6_ADDRSTRLEN];
int port = 0;
const struct sockaddr* addr = (const struct sockaddr*)address;
lua_newtable(L);
if (address->ss_family == AF_INET) {
if (addr->sa_family == AF_INET) {
struct sockaddr_in* addrin = (struct sockaddr_in*)address;
uv_inet_ntop(AF_INET, &(addrin->sin_addr), ip, INET6_ADDRSTRLEN);
port = ntohs(addrin->sin_port);
} else if (address->ss_family == AF_INET6) {
} else if (addr->sa_family == AF_INET6) {
struct sockaddr_in6* addrin6 = (struct sockaddr_in6*)address;
uv_inet_ntop(AF_INET6, &(addrin6->sin6_addr), ip, INET6_ADDRSTRLEN);
port = ntohs(addrin6->sin6_port);
}

lua_pushstring(L, luv_af_num_to_string(address->ss_family));
lua_pushstring(L, luv_af_num_to_string(addr->sa_family));
lua_setfield(L, -2, "family");
lua_pushinteger(L, port);
lua_setfield(L, -2, "port");
Expand Down
2 changes: 1 addition & 1 deletion src/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static int luv_thread_arg_set(lua_State* L, luv_thread_arg_t* args, int idx, int
args->flags = flags;
while (i <= top && i < LUV_THREAD_MAXNUM_ARG + idx)
{
luv_val_t *arg = args->argv + i - idx;
luv_val_t *arg = args->argv + (i - idx);
arg->type = lua_type(L, i);
arg->ref[0] = arg->ref[1] = LUA_NOREF;
switch (arg->type)
Expand Down