[libc-commits] [PATCH] D129808: [libc] add unsafe mode to strlen

Michael Jones via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Jul 14 15:22:01 PDT 2022


michaelrj created this revision.
michaelrj added reviewers: sivachandra, lntue.
Herald added subscribers: libc-commits, ecnelises, tschuett, mgorny.
Herald added projects: libc-project, All.
michaelrj requested review of this revision.

The only safe way to implement strlen involves reading the string one
char at a time. It is faster to read in larger blocks, but this leads to
reading beyond the string boundary, which is undefined behavior. This
patch adds an implementation and flag to use this fast but unsafe
version of strlen.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129808

Files:
  libc/src/string/CMakeLists.txt
  libc/src/string/string_utils.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129808.444813.patch
Type: text/x-patch
Size: 3845 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20220714/dd6d7b50/attachment.bin>


More information about the libc-commits mailing list