Repository navigation
Commit d88a6b9
authored
Issue introduced in commit 1994e3f, raised in comment #162500 (comment).
`delta_new_impl()` calls `accum()`, which in turn calls `PyNumber_Multiply()` and `PyNumber_Add()`, whose arguments could be a subclass of int or float that overloads `__mul__`/`__add__` with arbitrary Python code. `delta_new_impl()` calls `accum()` for 7 times in sequnce, with each of the 7 timeunit arguments, all with borrowed references, from `microseconds` to `weeks`. Chances are that those arbitrary Python code could release strong references of one of the 7 timeunit arguments. When `accum()` is called with an argument whose last references has been destroyed, it operates on a dangling pointer.
Should let `delta_new_impl()` hold strong references of its arguments to avoid being released early.
1 parent ebd4a5d commit d88a6b9
1 file changed
Lines changed: 21 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2795 | 2795 | | |
2796 | 2796 | | |
2797 | 2797 | | |
| 2798 | + | |
| 2799 | + | |
| 2800 | + | |
| 2801 | + | |
| 2802 | + | |
| 2803 | + | |
| 2804 | + | |
| 2805 | + | |
| 2806 | + | |
| 2807 | + | |
2798 | 2808 | | |
2799 | 2809 | | |
2800 | 2810 | | |
2801 | 2811 | | |
2802 | 2812 | | |
2803 | | - | |
| 2813 | + | |
2804 | 2814 | | |
2805 | 2815 | | |
2806 | 2816 | | |
| |||
2886 | 2896 | | |
2887 | 2897 | | |
2888 | 2898 | | |
2889 | | - | |
| 2899 | + | |
| 2900 | + | |
| 2901 | + | |
| 2902 | + | |
| 2903 | + | |
| 2904 | + | |
| 2905 | + | |
| 2906 | + | |
| 2907 | + | |
| 2908 | + | |
2890 | 2909 | | |
2891 | 2910 | | |
2892 | 2911 | | |
| |||
0 commit comments