Program: 91762
Project: 91762
Buggy source:
private static IFile getFileForPathImpl(IPath path,IProject project){
  IWorkspaceRoot root=ResourcesPlugin.getWorkspace().getRoot();
  if (path.isAbsolute()) {
    return root.getFileForLocation(path);
  }
  if (project != null && project.exists()) {
    ICProject cproject=CoreModel.getDefault().create(project);
    if (cproject != null) {
      try {
        ISourceRoot[] roots=cproject.getAllSourceRoots();
        for (        ISourceRoot sourceRoot : roots) {
          IResource r=sourceRoot.getResource();
          if (r instanceof IContainer) {
            IContainer parent=(IContainer)r;
            IResource res=parent.findMember(path);
            if (res != null && res.exists() && res instanceof IFile) {
              return (IFile)res;
            }
          }
        }
        IOutputEntry entries[]=cproject.getOutputEntries();
        for (        IOutputEntry pathEntry : entries) {
          IPath p=pathEntry.getPath();
          IResource r=root.findMember(p);
          if (r instanceof IContainer) {
            IContainer parent=(IContainer)r;
            IResource res=parent.findMember(path);
            if (res != null && res.exists() && res instanceof IFile) {
              return (IFile)res;
            }
          }
        }
      }
 catch (      CModelException e) {
        Activator.getDefault().getLog().log(e.getStatus());
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private static IFile getFileForPathImpl(IPath path,IProject project){
  IWorkspaceRoot root=ResourcesPlugin.getWorkspace().getRoot();
  if (path.isAbsolute()) {
    return root.getFileForLocation(path);
  }
  if (project != null && project.exists()) {
    ICProject cproject=CoreModel.getDefault().create(project);
    if (cproject != null) {
      try {
        ISourceRoot[] roots=cproject.getAllSourceRoots();
        for (        ISourceRoot sourceRoot : roots) {
          IResource r=sourceRoot.getResource();
          if (r instanceof IContainer) {
            IContainer parent=(IContainer)r;
            IResource res=parent.findMember(path);
            if (res != null && res.exists() && res instanceof IFile) {
              return (IFile)res;
            }
          }
        }
        IOutputEntry entries[]=cproject.getOutputEntries();
        for (        IOutputEntry pathEntry : entries) {
          IPath p=pathEntry.getPath();
          IResource r=root.findMember(p);
          if (r instanceof IContainer) {
            IContainer parent=(IContainer)r;
            IResource res=parent.findMember(path);
            if (res != null && res.exists() && res instanceof IFile) {
              return (IFile)res;
            }
          }
        }
      }
 catch (      CModelException e) {
        Activator.getDefault().getLog().log(e.getStatus());
      }
    }
  }
  IPath realPath=project.getLocation().append(path).makeAbsolute();
  URI realURI=URIUtil.toURI(realPath.toString());
  try {
    FindLinkedResourceVisitor visitor=new STLink2SourceSupport.FindLinkedResourceVisitor(realURI);
    project.accept(visitor,IResource.DEPTH_INFINITE);
    if (visitor.foundElement()) {
      IResource elementResource=visitor.getResource();
      return (IFile)elementResource;
    }
  }
 catch (  CoreException e) {
  }
  return null;
}