[issue34084] possible free statically allocated string in compiler when easter egg on

STINNER Victor report at bugs.python.org
Wed Jul 11 06:13:52 EDT 2018


STINNER Victor <vstinner at redhat.com> added the comment:

> Could you add a test in test_flufl.py that will fail with not patched code?

It seems like PyObject_FREE() is never called with the static string "with Barry as BDFL, use '<>' instead of '!='".

When parsetok() goes to code path (1):

                err_ret->text = "with Barry as BDFL, use '<>' "
                                "instead of '!='";

Later, it goes to code path (2) as well:

        if (tok->buf != NULL) {
            ...
            err_ret->text = (char *) PyObject_MALLOC(len + 1);

Hum, I modified my PR to removed *dead code*:

                err_ret->text = "with Barry as BDFL, use '<>' "
                                "instead of '!='";

> This issue and issue34080 look unrelated to me. They can be fixed independently.

In practice, both issues are related and it seems easier to me to fix them both at the same time ;-)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34084>
_______________________________________


More information about the Python-bugs-list mailing list