OT: UBsan and Asan makefile targets

Hi Everyone,

Great work on the sanitizers. I can't express how useful they are.

The Crypto++ project just promoted them to first class makefile
targets for internal testing.

For other who want to do the same, one can perform similar to the
following if using GNU Make (sorry, the Posix Make folks are out of
luck):

  # Undefined Behavior Sanitzier (Clang and G++)
  ifeq ($(findstring ubsan,$(MAKECMDGOALS)),ubsan)
  CXXFLAGS += -fsanitize=undefined
  endif # UBsan

  # Address Sanitzier (Clang and G++)
  ifeq ($(findstring asan,$(MAKECMDGOALS)),asan)
  CXXFLAGS += -fsanitize=address
  endif # Asan

Then, we provide a recipe for them:

  asan ubsan: libcryptopp.a cryptest.exe

Jeff

Hi Jeffrey,

I’m glad to hear that.

If you liked the sanitizers, you may also like libFuzzer (llvm.org/docs/LibFuzzer.html).
Also, did you try msan?

–kcc

There is also -fsanitize=integer (Clang-only) although it may report false positives.

-Y