This is an archive of the discontinued LLVM Phabricator instance.

[libc] Make string entrypoints mutualy exclusive.
ClosedPublic

Authored by gchatelet on Nov 19 2021, 4:47 PM.

Details

Summary

For example, strcpy does not pull memcpy now.

Diff Detail

Event Timeline

sivachandra created this revision.Nov 19 2021, 4:47 PM
sivachandra requested review of this revision.Nov 19 2021, 4:47 PM
gchatelet added inline comments.Nov 22 2021, 1:04 AM
libc/src/string/mempcpy.cpp
20–23

nit: Not sure this is part of the spec. It's probably fine to let it SIGSEGV.

24

nit: Not strictly necessary since every pointer casts to void*

libc/src/string/strcpy.cpp
19–20

that would be dest

Address comments.

sivachandra marked an inline comment as done.Nov 22 2021, 12:36 PM
sivachandra added inline comments.
libc/src/string/mempcpy.cpp
24

I tried to retain the original as much as possible. But, I changed according to your suggestion.

libc/src/string/strcpy.cpp
19–20

Thanks for catching this. But, I completely removed the sanitizer part now as we don't use memcpy anymore.

gchatelet accepted this revision.Nov 23 2021, 3:30 AM

The code is clearer now with much less reinterpret_casts :)

This revision is now accepted and ready to land.Nov 23 2021, 3:30 AM
gchatelet commandeered this revision.Nov 26 2021, 8:27 AM
gchatelet edited reviewers, added: sivachandra; removed: gchatelet.

@sivachandra I'll push this patch if you don't mind.

This revision now requires review to proceed.Nov 26 2021, 8:27 AM
gchatelet accepted this revision.Nov 26 2021, 8:29 AM
This revision is now accepted and ready to land.Nov 26 2021, 8:29 AM
This revision was landed with ongoing or failed builds.Nov 26 2021, 8:33 AM
This revision was automatically updated to reflect the committed changes.