This is an archive of the discontinued LLVM Phabricator instance.

Add interceptors for wcsxfrm, wcsxfrm_l
ClosedPublic

Authored by oliverchang on Mar 5 2018, 9:06 PM.

Event Timeline

oliverchang created this revision.Mar 5 2018, 9:06 PM

fix condition

vitalybuka accepted this revision.Mar 6 2018, 11:34 AM

Are you going to move strxfrm into common as well? In the different patch?
If not, I'll move it myself, for consistency.

lib/sanitizer_common/sanitizer_common_interceptors.inc
6529

sizeof(wchar_t) * (REAL(wcslen)(src) + 1)

6532

Please remove {}

6543

sizeof(wchar_t) * (REAL(wcslen)(src) + 1)

test/msan/wcsxfrm.cc
12

you may try to add test case where it catches poisoned bytes in the src string.

This revision is now accepted and ready to land.Mar 6 2018, 11:34 AM
vitalybuka requested changes to this revision.Mar 6 2018, 11:35 AM

because of COMMON_INTERCEPTOR_READ_RANGE argument

This revision now requires changes to proceed.Mar 6 2018, 11:35 AM
oliverchang marked 3 inline comments as done.

address comments

oliverchang added inline comments.Mar 6 2018, 2:50 PM
lib/sanitizer_common/sanitizer_common_interceptors.inc
6529

Fixed. thanks!

6532

Done.

6543

Done.

test/msan/wcsxfrm.cc
12

Added one here.

Please commit this if this looks good, thanks!

vitalybuka accepted this revision.Mar 6 2018, 3:01 PM

I'll commit.

This revision is now accepted and ready to land.Mar 6 2018, 3:01 PM

Thanks!

And oops, missed your comment about strxfrm. I can move that in a subsequent patch if you haven't already started doing that.

This revision was automatically updated to reflect the committed changes.

Hmm, looks like we might need "#include <xlocale.h>" when compiling on macos for both compiler-rt/test/sanitizer_common/TestCases/Posix/strxfrm.c and compiler-rt/test/sanitizer_common/TestCases/Posix/wcsxfrm.c ?