Skip to main content
summaryrefslogtreecommitdiffstats
path: root/launch
diff options
context:
space:
mode:
authorJohn Cortell2008-08-19 19:44:07 +0000
committerJohn Cortell2008-08-19 19:44:07 +0000
commita317f3f74a6fb5a75670b819b41d7c8839cc61ff (patch)
tree3d6612bad8e87a0d4d043a251caf99879225cea1 /launch
parent174683ad9e6e38997ea2ccf7d3d53b42a2f69ed8 (diff)
downloadorg.eclipse.cdt-a317f3f74a6fb5a75670b819b41d7c8839cc61ff.tar.gz
org.eclipse.cdt-a317f3f74a6fb5a75670b819b41d7c8839cc61ff.tar.xz
org.eclipse.cdt-a317f3f74a6fb5a75670b819b41d7c8839cc61ff.zip
Fix for 244605. Unrecoverable behavior if user stores a path in LC program name that points outside the project directory ("../something", e.g.).
Diffstat (limited to 'launch')
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java
index 4160cfdab93..e64d1cb6389 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java
@@ -31,6 +31,7 @@ import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
import org.eclipse.cdt.ui.CElementLabelProvider;
import org.eclipse.cdt.utils.pty.PTY;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -549,11 +550,20 @@ public class CMainTab extends CLaunchConfigurationTab {
}
IPath exePath = new Path(name);
if (!exePath.isAbsolute()) {
- if (!project.getFile(name).exists()) {
+ IFile projFile = null;
+ try {
+ projFile = project.getFile(name);
+ }
+ catch (Exception exc) {
+ // throws an exception if it's a relative path pointing outside project
+ setErrorMessage(LaunchMessages.getString("CMainTab.Program_invalid_proj_path")); //$NON-NLS-1$
+ return false;
+ }
+ if (projFile == null || !projFile.exists()) {
setErrorMessage(LaunchMessages.getString("CMainTab.Program_does_not_exist")); //$NON-NLS-1$
return false;
}
- exePath = project.getFile(name).getLocation();
+ exePath = projFile.getLocation();
} else {
if (!exePath.toFile().exists()) {
setErrorMessage(LaunchMessages.getString("CMainTab.Program_does_not_exist")); //$NON-NLS-1$

Back to the top