Skip to content

Commit

Permalink
fix _decompress security problem (PaddlePaddle#61294) (PaddlePaddle#6…
Browse files Browse the repository at this point in the history
  • Loading branch information
wanghuancoder committed Jan 31, 2024
1 parent aeaa0ca commit 0227a0d
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 @@ -311,7 +311,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 @@ -340,7 +343,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 0227a0d

Please sign in to comment.