[PATCH] D59262: [scudo][standalone] Add string utility functions

Mitch Phillips via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 12 12:52:08 PDT 2019


hctim added inline comments.


================
Comment at: lib/scudo/standalone/string_utils.cc:24
+
+uptr getStringLengthN(const char *S, uptr MaxLen) {
+  uptr I = 0;
----------------
vitalybuka wrote:
> cryptoad wrote:
> > vitalybuka wrote:
> > > do you need internal implementation of these functions? Why can't you use libc?
> > > I would expect that scudo has no the same restrictions as sanitizer_common
> > With those, I am slightly worried about localization in the libc, and how strings might end up being processed, with possibly at some point heap allocations.
> > Looking around it looks like strlen/strnlen/strcmp/strncmp are generally safe (glibc/bionic) but it's not an exhaustive assessment.
> > strtol appears to be far more complicated.
> > You likely know better about those intricacies, let me know what you think!
> I would go with as little as possible of custom code.
> Add them when you hit an issue?
Similar to this, is there any particular reason why we're not using the current sanitizer printf commons and basically copying the code? Are we trying to avoid bringing compiler-rt along with us wherever scuda goes? If this is the case, it doesn't look like the printf commons have much that we're not using, and doesn't have any large dependencies on other things in compiler-rt, could we use the commons instead?


Repository:
  rCRT Compiler Runtime

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59262/new/

https://reviews.llvm.org/D59262





More information about the llvm-commits mailing list