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

Fix some Address Sanitizer errors #384

Merged
merged 2 commits into from
Jul 9, 2024
Merged

Fix some Address Sanitizer errors #384

merged 2 commits into from
Jul 9, 2024

Conversation

dethrace-labs
Copy link
Owner

Running with address sanitizer raised a couple of errors:

  • CollCheck made some assumptions that the colliding object is a tCar_spec, when it could be a tNon_car_spec.
  • CreateSplash makes similar assumptions.

A fairly reliable repro is to collide with the wrecked car next to the water in Maim Street and knock it into the water

Comment on lines +13 to +16
if (DETHRACE_ASAN)
target_compile_options(dethrace_obj PUBLIC -fsanitize=address)
target_link_options(dethrace_obj PUBLIC -fsanitize=address)
endif()
Copy link
Collaborator

@madebr madebr Jul 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should do this in the top CMakeList.txt, and do the following instead?

add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=addres)

Then we are sure everything is built with address sanitizer (including brender and 3rd party deps).
Or don't we want to build those with sanitizer support?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My intention was to only target dethrace. BRender already has its own sanitizer config and I didn't want to wade into the 3rd party deps!

Copy link
Collaborator

@madebr madebr Jul 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense :)

I generally don't use the dethrace asan options, and configure the project with -DCMAKE_C_FLAGS="-fsanitize=address and -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address".

@dethrace-labs dethrace-labs merged commit ca1098a into main Jul 9, 2024
6 checks passed
@dethrace-labs dethrace-labs deleted the fix_asan_errors branch July 9, 2024 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants