Skip to content

Commit

Permalink
fix _decompress security problem (#61294)
Browse files Browse the repository at this point in the history
  • Loading branch information
wanghuancoder committed Jan 30, 2024
1 parent 495c991 commit 4453ce5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions python/paddle/utils/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,10 @@ def _decompress(fname):

def _uncompress_file_zip(filepath):
with zipfile.ZipFile(filepath, 'r') as files:
file_list = files.namelist()
file_list_tmp = files.namelist()
file_list = []
for file in file_list_tmp:
file_list.append(file.replace("../", ""))

file_dir = os.path.dirname(filepath)

Expand Down Expand Up @@ -342,7 +345,10 @@ def _uncompress_file_zip(filepath):

def _uncompress_file_tar(filepath, mode="r:*"):
with tarfile.open(filepath, mode) as files:
file_list = files.getnames()
file_list_tmp = files.getnames()
file_list = []
for file in file_list_tmp:
file_list.append(file.replace("../", ""))

file_dir = os.path.dirname(filepath)

Expand Down

0 comments on commit 4453ce5

Please sign in to comment.