serfend / pydumpck

a multi-threads tool for decompile exe,elf,pyz,pyc packed by python which is base on pycdc and uncompyle6.
https://pypi.org/project/pydumpck/
317 stars 35 forks source link

Bug: Invalid File Path in `handle_pyc_file` Method #60

Open 0x11DFE opened 7 months ago

0x11DFE commented 7 months ago

In the handle_pyc_file method of the py_common_dump module, there's an issue with the way the new_file path is being constructed. The current implementation concatenates the output_dir and target_file paths directly, which can result in an invalid path if target_file is an absolute path.

Here's the problematic line of code:

new_file = f'{output_dir}{os.path.sep}{target_file}'

This line should be replaced with:

new_file = os.path.join(output_dir, os.path.basename(target_file))