зеркало из https://github.com/microsoft/clang-1.git
[analyzer] scan-view: don't ever serve absolute paths.
At one point in time scan-view allowed absolute paths to reference files within the server root, but this doesn't seem to be used anymore, and caused problems if a server-root-relative path actually matched an absolute path to an existing file. This patch just treats paths as server-root-relative all the time. PR15843 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180715 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
7e6b564d59
Коммит
1d75a3b8ef
|
@ -686,16 +686,8 @@ File Bug</h3>
|
|||
if components[-1] == '':
|
||||
components[-1] = 'index.html'
|
||||
|
||||
suffix = '/'.join(components)
|
||||
|
||||
# The summary may reference source files on disk using rooted
|
||||
# paths. Make sure these resolve correctly for now.
|
||||
# FIXME: This isn't a very good idea... we should probably
|
||||
# mark rooted paths somehow.
|
||||
if os.path.exists(posixpath.join('/', suffix)):
|
||||
path = posixpath.join('/', suffix)
|
||||
else:
|
||||
path = posixpath.join(self.server.root, suffix)
|
||||
relpath = '/'.join(components)
|
||||
path = posixpath.join(self.server.root, relpath)
|
||||
|
||||
if self.server.options.debug > 1:
|
||||
print >>sys.stderr, '%s: SERVER: sending path "%s"'%(sys.argv[0],
|
||||
|
@ -708,8 +700,8 @@ File Bug</h3>
|
|||
|
||||
def send_path(self, path):
|
||||
# If the requested path is outside the root directory, do not open it
|
||||
rel = os.path.abspath(os.path.join(self.server.root, path))
|
||||
if not rel.startswith(os.path.abspath(self.server.root) ):
|
||||
rel = os.path.abspath(path)
|
||||
if not rel.startswith(os.path.abspath(self.server.root)):
|
||||
return self.send_404()
|
||||
|
||||
ctype = self.guess_type(path)
|
||||
|
|
Загрузка…
Ссылка в новой задаче