Commit d02f6cb
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's internal code will never try to reallocate memory.
Fixes: #768
Reported-by: David Delassus <david.jose.delassus@gmail.com>1 parent a329721 commit d02f6cb
File tree
3 files changed
+34
-25
lines changed- demo/sdl3_renderer
- src
3 files changed
+34
-25
lines changed| 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 | |
|---|---|---|---|
| |||
8524 | 8524 | | |
8525 | 8525 | | |
8526 | 8526 | | |
8527 | | - | |
| 8527 | + | |
| 8528 | + | |
| 8529 | + | |
| 8530 | + | |
| 8531 | + | |
| 8532 | + | |
| 8533 | + | |
| 8534 | + | |
| 8535 | + | |
| 8536 | + | |
8528 | 8537 | | |
8529 | 8538 | | |
8530 | 8539 | | |
| |||
8617 | 8626 | | |
8618 | 8627 | | |
8619 | 8628 | | |
8620 | | - | |
8621 | | - | |
8622 | | - | |
| 8629 | + | |
8623 | 8630 | | |
| 8631 | + | |
| 8632 | + | |
| 8633 | + | |
| 8634 | + | |
8624 | 8635 | | |
8625 | | - | |
8626 | | - | |
8627 | | - | |
8628 | | - | |
| 8636 | + | |
| 8637 | + | |
8629 | 8638 | | |
8630 | 8639 | | |
8631 | 8640 | | |
| |||
| 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 | | - | |
108 | | - | |
109 | | - | |
| 116 | + | |
110 | 117 | | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
111 | 122 | | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
| 123 | + | |
| 124 | + | |
116 | 125 | | |
117 | 126 | | |
118 | 127 | | |
| |||
0 commit comments