Express the strto* interceptors though macros. This removes a lot of
duplicate code and fixes a couple of copypasto bugs (where "res" was declared of
a different type than the actual return type). Also, add a few more interceptors
for strto*_l.
Details
- Reviewers
eugenis
Diff Detail
Event Timeline
I started similarly rewriting the strto* tests in tests/msan_test.cc, but it turns out that the tests in this file are not run as part of check-msan. What's up with that?
Also, who uses the __-prefixed versions? Should we add them for the newly added functions as well?
libstdc++ depends on these:
__strtof_l __strtod_l strtoul strtold_l
Please add all of them for completeness.
Also, could you move this to sanitizer_common_interceptors.inc, while you are at it?
Also, could you move this to sanitizer_common_interceptors.inc, while you are at it?
Maybe in a separate CL. But what would that achieve? These interceptors wouldn't have any effect in ASan (and there's already a conflicting implementation of strol).
The fact that there is an strtol interceptor in asan means there is _something_ to achieve, right? :)
Common interceptors would do READ on the input string, and let us catch asan bugs and tsan data races on that memory.
ASan interceptor has interesting look ahead logic that should also be merged to the common interceptor.
OK to do it in a separate commit later.
LGTM.