Skip to content

Commit 74ec2d0

Browse files
Refleak demo
1 parent 275056a commit 74ec2d0

6 files changed

Lines changed: 11 additions & 18 deletions

File tree

Include/internal/pycore_opcode_metadata.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_structs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ typedef struct {
5555
#include "pycore_context.h" // _PyContextTokenMissing
5656

5757
// Define this to get precise tracking of stackrefs.
58-
// #define Py_STACKREF_DEBUG 1
58+
#define Py_STACKREF_DEBUG 1
5959

6060
typedef union _PyStackRef {
6161
#if !defined(Py_GIL_DISABLED) && defined(Py_STACKREF_DEBUG)

Include/internal/pycore_uop_metadata.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/bytecodes.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,10 @@ dummy_func(
909909
PyObject *res_o = (PyObject*)&_Py_SINGLETON(strings).ascii[c];
910910
PyStackRef_CLOSE_SPECIALIZED(sub_st, _PyLong_ExactDealloc);
911911
DEAD(sub_st);
912-
PyStackRef_CLOSE(str_st);
912+
// Let's say I forgot to close this
913+
// PyStackRef_CLOSE(str_st);
914+
// ... Instead I mark it dead
915+
DEAD(str_st);
913916
res = PyStackRef_FromPyObjectImmortal(res_o);
914917
}
915918

Python/executor_cases.c.h

Lines changed: 2 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/generated_cases.c.h

Lines changed: 2 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)