Avi Kivity
329b135b5e
Merge 'chunked_vector: fix use after free in emplace back' from Benny Halevy
...
Currently, push_back or emplace_back reallocate the last chunk
before constructing the new element.
If the arg passed to push_back/emplace_back is a reference to an
existing element in the vector, reallocating the last chunk will
invalidate the arg reference before it is used.
This patch changes the order when reallocating
the last chunk in reserve_for_emplace_back:
First, a new chunk_ptr is allocated.
Then, the back_element is emplaced in the
newly allocated array.
And only then, existing elements in the current
last chunk are migrated to the new chunk.
Eventually, the new chunk replaces the existing chunk.
If no reservation is requried, the back element
is emplaced "in place" in the current last chunk.
Fixes scylladb/scylladb#18072
Closes scylladb/scylladb#18073
* github.com:scylladb/scylladb:
test: chunked_managed_vector_test: add test_push_back_using_existing_element
utils: chunked_vector: reserve_for_emplace_back: emplace before migrating existing elements
utils: chunked_vector: push_back: call emplace_back
utils: chunked_vector: define min_chunk_capacity
utils: chunked*vector: use std::clamp
2024-04-30 18:09:04 +03:00
..
2024-02-06 13:22:16 +02:00
2024-02-06 13:22:16 +02:00
2024-01-15 13:26:39 +02:00
2024-04-25 14:33:21 +02:00
2024-02-06 13:22:16 +02:00
2024-02-02 22:12:57 +08:00
2024-04-19 22:56:16 +08:00
2024-04-19 07:44:07 +03:00
2024-02-02 22:12:57 +08:00
2024-02-06 13:22:16 +02:00
2024-02-06 13:22:16 +02:00
2024-04-19 22:57:36 +08:00
2024-02-02 22:12:57 +08:00
2024-04-11 14:34:50 +03:00
2024-04-11 14:34:48 +03:00
2024-02-21 19:38:53 +02:00
2024-03-13 09:29:00 +02:00
2024-04-19 22:56:16 +08:00
2024-02-02 22:12:57 +08:00
2024-03-18 13:37:44 +02:00
2024-04-26 14:45:29 +02:00
2024-01-11 08:37:56 +02:00
2024-02-06 13:22:16 +02:00
2024-04-19 22:56:16 +08:00
2024-02-06 13:22:16 +02:00
2024-02-06 13:22:16 +02:00
2024-04-19 22:56:16 +08:00
2024-02-06 13:22:16 +02:00
2024-04-26 14:45:29 +02:00
2024-02-06 13:22:16 +02:00
2024-04-23 16:28:25 +03:00
2024-02-06 13:22:16 +02:00
2024-01-18 12:50:06 +02:00
2023-12-02 22:37:22 +02:00
2024-02-06 13:22:16 +02:00
2024-04-19 07:44:07 +03:00
2024-03-21 14:35:38 +01:00
2024-02-06 13:22:16 +02:00
2024-02-06 13:22:16 +02:00
2024-04-19 22:57:36 +08:00
2024-02-06 13:22:16 +02:00
2024-03-13 08:52:46 +02:00
2024-02-06 13:22:16 +02:00
2024-02-02 22:12:57 +08:00
2024-02-22 17:53:34 +08:00
2024-03-17 16:58:39 +02:00
2024-04-19 22:56:16 +08:00
2024-04-19 22:56:16 +08:00
2024-01-11 08:37:56 +02:00
2024-01-29 09:59:30 +02:00
2024-02-06 13:22:16 +02:00
2024-02-02 22:12:57 +08:00
2024-02-06 13:22:16 +02:00
2024-02-06 13:22:16 +02:00
2024-02-02 22:12:57 +08:00
2024-02-02 22:12:57 +08:00
2024-02-02 22:12:57 +08:00
2024-02-06 13:22:16 +02:00
2024-02-02 22:12:57 +08:00
2024-04-25 16:03:01 +03:00
2024-02-06 13:22:16 +02:00
2024-02-06 13:22:16 +02:00
2024-04-19 22:56:16 +08:00
2024-02-06 13:22:16 +02:00
2024-04-19 22:56:16 +08:00
2024-04-19 22:57:36 +08:00
2024-03-13 08:52:46 +02:00
2024-04-19 22:56:16 +08:00
2024-03-20 22:39:51 +04:00
2024-04-19 22:56:16 +08:00
2024-02-07 18:31:36 +01:00
2024-04-19 22:57:36 +08:00
2024-02-21 19:43:17 +02:00
2024-02-06 13:22:16 +02:00
2024-04-19 22:57:36 +08:00
2024-01-11 14:33:47 +08:00
2024-04-19 22:56:16 +08:00
2024-02-06 13:22:16 +02:00
2024-03-11 11:37:48 +02:00
2024-04-19 22:56:16 +08:00
2024-04-04 16:03:05 +02:00
2024-04-19 22:56:16 +08:00
2024-02-06 13:22:16 +02:00
2024-04-19 22:57:36 +08:00
2024-04-19 22:56:16 +08:00
2024-02-02 22:12:57 +08:00
2024-04-25 14:33:21 +02:00
2024-02-06 13:22:16 +02:00
2024-01-04 03:20:17 -05:00
2024-03-26 15:31:18 +02:00
2024-02-02 22:12:57 +08:00
2023-12-05 15:18:11 +02:00
2024-02-06 13:22:16 +02:00
2023-12-05 14:09:34 +01:00
2024-04-19 22:57:36 +08:00
2024-02-06 13:22:16 +02:00
2024-04-22 15:24:18 +02:00
2024-04-19 22:56:16 +08:00
2024-04-02 09:25:06 +03:00
2024-04-25 19:15:59 +03:00
2024-04-19 22:56:16 +08:00
2023-12-05 08:25:04 +03:00
2024-02-02 22:12:57 +08:00
2024-02-21 19:43:17 +02:00
2024-02-02 22:12:57 +08:00
2024-02-02 22:12:57 +08:00
2024-04-17 07:12:39 +03:00
2024-02-02 22:12:57 +08:00
2024-04-19 22:56:16 +08:00
2024-04-19 22:57:36 +08:00
2024-01-24 10:37:39 +01:00
2024-02-06 13:22:16 +02:00
2024-04-25 14:33:21 +02:00
2024-04-19 22:57:36 +08:00
2024-02-06 13:22:16 +02:00
2024-02-06 13:22:16 +02:00
2024-03-26 13:38:37 +08:00
2024-04-19 22:56:16 +08:00
2024-04-19 22:56:16 +08:00
2024-03-26 13:38:37 +08:00
2024-04-19 22:56:16 +08:00
2024-04-19 22:56:16 +08:00
2024-02-06 13:22:16 +02:00
2024-02-06 13:22:16 +02:00
2024-02-02 22:12:57 +08:00
2024-02-06 13:22:16 +02:00
2024-02-06 13:22:16 +02:00
2024-02-06 13:22:16 +02:00
2024-04-19 22:57:36 +08:00