Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Double-free in Argument Clinicstr_converter generated code #99240

Closed
Assignees
gpshead
@colorfulappl

Description

@colorfulappl

Argument Clinicstr_converter generate such code whenencoding is set
(see functiontest_str_converter_encoding in file Lib/test/clinic.test):

/* -- snip -- */if (!_PyArg_ParseStack(args,nargs,"esesetes#et#:test_str_converter_encoding","idna",&a,"idna",&b,"idna",&c,"idna",&d,&d_length,"idna",&e,&e_length)) {        gotoexit;    }return_value=test_str_converter_encoding_impl(module,a,b,c,d,d_length,e,e_length);exit:/* Cleanup for a */if (a) {PyMem_FREE(a);    }/* Cleanup for b */if (b) {PyMem_FREE(b);    }/* Cleanup for c */if (c) {PyMem_FREE(c);    }/* -- snip -- */

If parsinga successes,a will be assigned an address points to an allocated memory.
After that, if parsingb fails, the memory whicha points to is freed by function_PyArg_ParseStack,
and_PyArg_ParseStack returns 0, then control flow goes to label "exit".
At this time,a is not NULL, so the memory it points to is freed again, which cause a double-free problem and a runtime crash.

This bug is found in#96178 "Argument Clinic functional test".

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp