Commit 35000ac
authored
Prevent double free for too big repetition quantifiers (ruby#13332)
Prevent double free for too big repetition quantifiers
The previous implementation calls `free(node)` twice (on parsing and compiling a
regexp) when it has an error, so it leads to a double-free issue. This
commit enforces `free(node)` once by introducing a temporal pointer to hold
parsing nodes.1 parent 6b10d40 commit 35000ac
2 files changed
Lines changed: 16 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6721 | 6721 | | |
6722 | 6722 | | |
6723 | 6723 | | |
6724 | | - | |
| 6724 | + | |
6725 | 6725 | | |
6726 | 6726 | | |
6727 | 6727 | | |
| |||
6737 | 6737 | | |
6738 | 6738 | | |
6739 | 6739 | | |
6740 | | - | |
6741 | | - | |
| 6740 | + | |
| 6741 | + | |
6742 | 6742 | | |
6743 | 6743 | | |
6744 | 6744 | | |
6745 | | - | |
| 6745 | + | |
6746 | 6746 | | |
6747 | 6747 | | |
6748 | 6748 | | |
6749 | 6749 | | |
6750 | | - | |
| 6750 | + | |
6751 | 6751 | | |
6752 | 6752 | | |
6753 | 6753 | | |
6754 | 6754 | | |
6755 | | - | |
| 6755 | + | |
6756 | 6756 | | |
6757 | 6757 | | |
6758 | | - | |
| 6758 | + | |
| 6759 | + | |
6759 | 6760 | | |
| 6761 | + | |
| 6762 | + | |
6760 | 6763 | | |
6761 | 6764 | | |
6762 | 6765 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1875 | 1875 | | |
1876 | 1876 | | |
1877 | 1877 | | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
| 1883 | + | |
1878 | 1884 | | |
1879 | 1885 | | |
1880 | 1886 | | |
| |||
0 commit comments