-
-
Notifications
You must be signed in to change notification settings - Fork 34.6k
Incorrect use of the C API in getpath_joinpath() #97758
Copy link
Copy link
Closed
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or errortype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
Metadata
Metadata
Assignees
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or errortype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
If the
getpath.joinpath()is called without arguments, it tries to return an empty string and callsPyUnicode_FromString(NULL)for this, which causes a crash. The correct way of creating an empty string isPyUnicode_FromStringAndSize(NULL, 0), orPyUnicode_FromString(""), orPyUnicode_FromStringAndSize("", 0).Alternatively, the function could raise a TypeError instead of returning an empty string.
@zooba @vstinner