Fix T84637
See T84637#1134707 and T84637#1135324
- Replace allocation tests with direct tests of MEM_size_safe_multiply.
- Disable death tests on macOS with ASan. Release builds will check if abort occurs or not, upon integer overflow.
Differential D10719
guardedalloc_test: Do overflow tests without allocation Authored by Ankit Meel (ankitm) on Mar 14 2021, 4:09 PM. Tags None Subscribers None
Details Fix T84637
Diff Detail
Event TimelineComment Actions Would be nice to test the actual allocations functions, but I can't think of a batter solution than this. About the names, perhaps use safe_multiply_pass and safe_multiply_fail. Comment Actions Rename Remove the base class include since test fixture is not used. Remove GCC pragma now that there are no allocations. Update top level comment.
Comment Actions If the EXPECT_EXIT can not be trusted on some platform/configuration this is to be checked with the upstream gtest library. Comment Actions It's not that EXPECT_EXIT can't be trusted, it's that it tests for exit with SIGABRT specifically and that the signal you get from a failing malloc (with asan) is not well-defined. Maybe the best solution is to add a EXIT_ANY_SIGNAL_PREDICATE that does not test for abort specifically. Comment Actions
The malloc is not relevant here.. Even if MallocArray function is edited to be empty (do nothing), the test will fail. AFAIK, it's due to fork(). See T84637#1135324 Comment Actions Ok, I think that may be a bug in asan/ubsan, or some odd behavior. Perhaps we should then change ABORT_PREDICATE to check for either SIGBART or SIGILL on macOS. Comment Actions
It'd be slightly deceptive to see a test pass without it even running. | ||||||||||