This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年08月22日 15:41 by vstinner, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| imp.patch | vstinner, 2012年08月22日 15:41 | review | ||
| Messages (4) | |||
|---|---|---|---|
| msg168892 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2012年08月22日 15:41 | |
_imp.load_dynamic() use UTF-8 (PyUnicode_FromString) to decode the error message from dlerror(), whereas the locale encoding should be used. The path is decoded from UTF-8, whereas the filesystem encoding should be used.
As a result, error_ob and path can be NULL, whereas Py_DECREF() is used and so Python does crash (SIGSEGV).
Attached patch should avoid a crash, but I'm not sure that it is enough to support non-ASCII path: pathname is "./" is the path is not an absolute path.
PyOS_snprintf(pathbuf, sizeof(pathbuf), "./%-.255s", pathname);
should maybe be replaced with
pathbytes = PyBytes_FromFormat("./%s", pathname);
|
|||
| msg168893 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2012年08月22日 15:46 | |
New changeset eaac55703796 by Victor Stinner in branch 'default': Issue #15766: Fix a crash in imp.load_dynamic() on PyUnicode_FromString() failure http://hg.python.org/cpython/rev/eaac55703796 |
|||
| msg168900 - (view) | Author: Martin v. Löwis (loewis) * (Python committer) | Date: 2012年08月22日 17:33 | |
The patch is still insufficient. Any of the functions can fail because of memory exhaustion, so a fix should really use the standard error handling procedure. |
|||
| msg171755 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2012年10月01日 22:59 | |
New changeset f3ed5e211fcc by Victor Stinner in branch 'default': Close #15766: Catch exceptions while raising the ImportError in imp.load_dynamic() http://hg.python.org/cpython/rev/f3ed5e211fcc |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:35 | admin | set | github: 59970 |
| 2012年10月01日 22:59:55 | python-dev | set | status: open -> closed resolution: fixed messages: + msg171755 stage: resolved |
| 2012年08月22日 17:33:14 | loewis | set | nosy:
+ loewis messages: + msg168900 |
| 2012年08月22日 15:46:50 | python-dev | set | nosy:
+ python-dev messages: + msg168893 |
| 2012年08月22日 15:41:22 | vstinner | create | |