Issue 36367: tokenizer.c memory leak in case of realloc failure
Created on 2019-03-19 16:12 by cstratak, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 12442 | merged | pablogsal, 2019-03-19 16:18 | |
| PR 12470 | merged | vstinner, 2019-03-20 11:22 | |
| PR 12471 | merged | vstinner, 2019-03-20 11:25 | |
| Messages (4) | |||
|---|---|---|---|
| msg338375 - (view) | Author: Charalampos Stratakis (cstratak) * | Date: 2019-03-19 16:12 | |
In tokenizer.c we have those lines of code [0]:
if (final_length < needed_length && final_length)
/* should never fail */
buf = PyMem_REALLOC(buf, final_length);
return buf;
If however that realloc fails, the memory allocated initially for buf, will not be freed.
[0] https://github.com/python/cpython/blob/master/Parser/tokenizer.c#L652
|
|||
| msg338391 - (view) | Author: Pablo Galindo Salgado (pablogsal) * ![]() |
Date: 2019-03-19 17:18 | |
New changeset cb90c89de14aab636739b3e810cf949e47b54a0c by Pablo Galindo in branch 'master': bpo-36367: Free buffer if realloc fails in tokenize.c (GH-12442) https://github.com/python/cpython/commit/cb90c89de14aab636739b3e810cf949e47b54a0c |
|||
| msg338459 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2019-03-20 12:03 | |
New changeset 65b9849f0f07a000d751c96d9d711aeb24c95224 by Victor Stinner in branch '3.7': bpo-36367: Free buffer if realloc fails in tokenize.c (GH-12442) (GH-12471) https://github.com/python/cpython/commit/65b9849f0f07a000d751c96d9d711aeb24c95224 |
|||
| msg338460 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2019-03-20 12:03 | |
New changeset 469b0a50d990bcb441910b23194c131e403c2833 by Victor Stinner in branch '2.7': bpo-36367: Free buffer if realloc fails in tokenize.c (GH-12442) (GH-12470) https://github.com/python/cpython/commit/469b0a50d990bcb441910b23194c131e403c2833 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:12 | admin | set | github: 80548 |
| 2019-03-20 12:03:56 | vstinner | set | versions: + Python 2.7, Python 3.7, Python 3.8 |
| 2019-03-20 12:03:43 | vstinner | set | messages: + msg338460 |
| 2019-03-20 12:03:18 | vstinner | set | nosy:
+ vstinner messages: + msg338459 |
| 2019-03-20 11:25:00 | vstinner | set | pull_requests: + pull_request12423 |
| 2019-03-20 11:22:14 | vstinner | set | pull_requests: + pull_request12422 |
| 2019-03-19 17:18:20 | pablogsal | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2019-03-19 17:18:05 | pablogsal | set | nosy:
+ pablogsal messages: + msg338391 |
| 2019-03-19 16:18:55 | pablogsal | set | keywords:
+ patch stage: patch review pull_requests: + pull_request12397 |
| 2019-03-19 16:12:41 | cstratak | create | |
