mirror of
https://github.com/python/cpython.git
synced 2026-05-06 04:37:33 -04:00
[3.11] gh-145506: Fixes CVE-2026-2297 by ensuring SourcelessFileLoader uses io.open_code (GH-145507) (#145515)
* gh-145506: Fixes CVE-2026-2297 by ensuring SourcelessFileLoader uses io.open_code (GH-145507)
(cherry picked from commit a51b1b512d)
Co-authored-by: Steve Dower <steve.dower@python.org>
* Fix docs reference
---------
Co-authored-by: Steve Dower <steve.dower@python.org>
This commit is contained in:
committed by
GitHub
parent
e20c6c9667
commit
69ddd9bb2c
@@ -1126,7 +1126,7 @@ class FileLoader:
|
||||
|
||||
def get_data(self, path):
|
||||
"""Return the data from path as raw bytes."""
|
||||
if isinstance(self, (SourceLoader, ExtensionFileLoader)):
|
||||
if isinstance(self, (SourceLoader, SourcelessFileLoader, ExtensionFileLoader)):
|
||||
with _io.open_code(str(path)) as file:
|
||||
return file.read()
|
||||
else:
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
Fixes CVE-2026-2297 by ensuring that ``SourcelessFileLoader`` uses
|
||||
:func:`io.open_code` when opening ``.pyc`` files.
|
||||
Reference in New Issue
Block a user