[New-bugs-announce] [issue29039] Segmentation fault when using PyUnicode_FromString

Matteo Cafasso report at bugs.python.org
Wed Dec 21 14:52:12 EST 2016


New submission from Matteo Cafasso:

The following code snippet:

----------------------------------------------
#include <stdio.h>
#include <Python.h>

int main()
{
    char *broken_string[8];
    char broken_char = 4294967252;

    sprintf(broken_string, "%c", broken_char);

    PyUnicode_FromString(broken_string);
}
----------------------------------------------

Produces a Segmentation Fault.

Is this behaviour the expected one? 

The real life example comes when reading a malformed path on a Ext4 filesystem. The read string causes PyUnicode_FromString to segfault.

----------
components: Extension Modules
messages: 283777
nosy: noxdafox
priority: normal
severity: normal
status: open
title: Segmentation fault when using PyUnicode_FromString
type: crash
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29039>
_______________________________________


More information about the New-bugs-announce mailing list