[PATCH] D17104: [VFS] Drop path traversal assertion

Ben Langmuir via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 19 18:00:08 PST 2016


benlangmuir accepted this revision.
benlangmuir added a comment.
This revision is now accepted and ready to land.

LGTM if you fix 256->PATH_MAX.


================
Comment at: lib/Frontend/ModuleDependencyCollector.cpp:66
@@ +65,3 @@
+#ifdef HAVE_REALPATH
+  char CanonicalPath[256];
+
----------------
Please use PATH_MAX.

================
Comment at: lib/Frontend/ModuleDependencyCollector.cpp:126-128
@@ -71,1 +125,5 @@
+  SmallString<256> RealPath;
+  bool HasSymLinkComponent = HasDotDotInPath &&
+                             getRealPath(AbsoluteSrc, RealPath) &&
+                             !StringRef(CanonicalPath).equals(RealPath);
 
----------------
How about "HasRemovedSymlinkComponent" to make it clear this is only for symlinks followed by ".."?

================
Comment at: test/Modules/crash-vfs-path-symlink-component.m:16
@@ +15,3 @@
+// RUN: %clang -fsyntax-only %s -I %/t/i -isysroot %/t/sysroot/ \
+// RUN: -fmodules -fmodules-cache-path=%t/m/ 2>&1 | FileCheck %s
+
----------------
Maybe add indentation after the RUN: to make it easier to see that the command is wrapped?


http://reviews.llvm.org/D17104





More information about the cfe-commits mailing list