[PATCH] D54247: Add interceptors for the fts(3) API family from NetBSD
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 7 20:27:13 PST 2018
vitalybuka added inline comments.
================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:7264
+ void *ctx;
+ void *fts;
+ COMMON_INTERCEPTOR_ENTER(ctx, fts_open, path_argv, options, compar);
----------------
please move to the first assignment
================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:7273
+ }
+ COMMON_INTERCEPTOR_READ_RANGE(ctx, pa, sizeof(char **));
+ }
----------------
we should check access before referencing
so
```
for (char *const *pa = path_argv;;++pa) {
COMMON_INTERCEPTOR_READ_RANGE(ctx, pa, sizeof(char **));
if (!*pa)
break;
COMMON_INTERCEPTOR_READ_RANGE(ctx, *pa, REAL(strlen)(*pa) + 1);
}
```
================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:7287
+ COMMON_INTERCEPTOR_READ_RANGE(ctx, ftsp, struct_FTS_sz);
+ ftsent = REAL(fts_read)(ftsp);
+ if (ftsent)
----------------
declare ftsent here
and the same for the next
================
Comment at: test/sanitizer_common/TestCases/NetBSD/fts.cc:27
+
+ while ((p = fts_read(ftsp)) != NULL) {
+ /* Skip recursively subdirectories */
----------------
== NULL or != NULL is not needed
Repository:
rL LLVM
https://reviews.llvm.org/D54247
More information about the llvm-commits
mailing list