Commit c1fa8e1
committed
Fix crash in nk_buffer_realloc and forbid the use of realloc
In short: the default implementation of nk_allocator (aka nk_malloc)
is fundamentally broken, and should have used realloc instead of malloc.
This led to the strange workaround in nk_buffer_realloc that would
crash whenever you use custom allocator with correct realloc assumption.
We cannot change nk_malloc at this point, as people could have
implemented their own allocators based on it, but we can ensure that
Nuklear itself will never try to reallocate memory.
Fixes: #7681 parent b5f67b8 commit c1fa8e1
4 files changed
Lines changed: 30 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | 115 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | 116 | | |
126 | 117 | | |
127 | 118 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8498 | 8498 | | |
8499 | 8499 | | |
8500 | 8500 | | |
8501 | | - | |
| 8501 | + | |
| 8502 | + | |
| 8503 | + | |
| 8504 | + | |
| 8505 | + | |
| 8506 | + | |
| 8507 | + | |
| 8508 | + | |
| 8509 | + | |
| 8510 | + | |
8502 | 8511 | | |
8503 | 8512 | | |
8504 | 8513 | | |
| |||
8591 | 8600 | | |
8592 | 8601 | | |
8593 | 8602 | | |
8594 | | - | |
| 8603 | + | |
8595 | 8604 | | |
8596 | 8605 | | |
8597 | 8606 | | |
8598 | 8607 | | |
8599 | | - | |
8600 | | - | |
8601 | | - | |
8602 | | - | |
| 8608 | + | |
| 8609 | + | |
8603 | 8610 | | |
8604 | 8611 | | |
8605 | 8612 | | |
| |||
30736 | 30743 | | |
30737 | 30744 | | |
30738 | 30745 | | |
| 30746 | + | |
| 30747 | + | |
30739 | 30748 | | |
30740 | 30749 | | |
30741 | 30750 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
15 | 24 | | |
16 | 25 | | |
17 | 26 | | |
| |||
104 | 113 | | |
105 | 114 | | |
106 | 115 | | |
107 | | - | |
| 116 | + | |
108 | 117 | | |
109 | 118 | | |
110 | 119 | | |
111 | 120 | | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
| 121 | + | |
| 122 | + | |
116 | 123 | | |
117 | 124 | | |
118 | 125 | | |
| |||
0 commit comments