aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfigurationLoader.java7
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java8
2 files changed, 11 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfigurationLoader.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfigurationLoader.java
index 9d4818ef24..23ee8f9e94 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfigurationLoader.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfigurationLoader.java
@@ -34,6 +34,7 @@ import com.google.devtools.build.lib.packages.Target;
import com.google.devtools.build.lib.packages.Type;
import com.google.devtools.build.lib.syntax.Label;
import com.google.devtools.build.lib.syntax.Label.SyntaxException;
+import com.google.devtools.build.lib.vfs.FileSystemUtils;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.view.config.crosstool.CrosstoolConfig;
@@ -150,6 +151,12 @@ public class CppConfigurationLoader implements ConfigurationFragmentFactory {
}
} else {
fdoZip = directories.getWorkspace().getRelative(cppOptions.fdoOptimize);
+ try {
+ // We don't check for file existence, but at least the filename should be well-formed.
+ FileSystemUtils.checkBaseName(fdoZip.getBaseName());
+ } catch (IllegalArgumentException e) {
+ throw new InvalidConfigurationException(e);
+ }
}
Label ccToolchainLabel;
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java
index c960ef8912..a2339c2b2a 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java
@@ -222,12 +222,12 @@ public class FdoSupport {
: Root.asDerivedRoot(execRoot, execRoot.getRelative("blaze-fdo"));
this.fdoRootExecPath = fdoProfile == null
? null
- : fdoRoot.getExecPath().getRelative(new PathFragment("_fdo").getChild(
- FileSystemUtils.removeExtension(fdoProfile.getBaseName())));
+ : fdoRoot.getExecPath().getRelative(FileSystemUtils.removeExtension(
+ new PathFragment("_fdo").getChild(fdoProfile.getBaseName())));
this.fdoPath = fdoProfile == null
? null
- : new PathFragment("_fdo").getChild(
- FileSystemUtils.removeExtension(fdoProfile.getBaseName()));
+ : FileSystemUtils.removeExtension(new PathFragment("_fdo").getChild(
+ fdoProfile.getBaseName()));
this.lipoMode = lipoMode;
this.useAutoFdo = fdoProfile != null && isAutoFdo(fdoProfile.getBaseName());
this.useLLVMFdo = fdoProfile != null && isLLVMFdo(fdoProfile.getBaseName());