Message ID | b7e3dd3cc870024f0e80dad26c5a7a96483c6cf4.1737970803.git.ps@pks.im (mailing list archive) |
---|---|
State | Accepted |
Commit | f11f0a5a2db955f68776ea95aec42df7fcb8ce1b |
Headers | show |
Series | [v4] refs/reftable: fix uninitialized memory access of `max_index` | expand |
On Mon, Jan 27, 2025 at 10:44:08AM +0100, Patrick Steinhardt wrote: > Karthik is out of office this week, so I'm taking over this series for > him to ensure that it lands soonish. The only change compared to v3 is > an adapted commit message based on my own feedback. Ugh, sorry, forgot to set the In-reply-to header. This was meant as a reply to [1]. Patrick [1]: <CAOLa=ZR=Hz+LU0n-uC2dpk8_sLqAyaxO0NswJH8bP_kEdDdbUQ@mail.gmail.com>
Patrick Steinhardt <ps@pks.im> writes: > On Mon, Jan 27, 2025 at 10:44:08AM +0100, Patrick Steinhardt wrote: >> Karthik is out of office this week, so I'm taking over this series for >> him to ensure that it lands soonish. The only change compared to v3 is >> an adapted commit message based on my own feedback. > > Ugh, sorry, forgot to set the In-reply-to header. This was meant as a > reply to [1]. > > Patrick > > [1]: <CAOLa=ZR=Hz+LU0n-uC2dpk8_sLqAyaxO0NswJH8bP_kEdDdbUQ@mail.gmail.com> Thanks, that was very helpful. This turns the v3 that was a replacement for a patch that was already in 'next' into an incremental form, and replaces the kn/reflog-migration-fix-fix topic which was my tentative attempt. Will queue.
diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c index 289496058e..d39a14c5a4 100644 --- a/refs/reftable-backend.c +++ b/refs/reftable-backend.c @@ -1020,6 +1020,7 @@ static int prepare_transaction_update(struct write_transaction_table_arg **out, arg->updates_nr = 0; arg->updates_alloc = 0; arg->updates_expected = 0; + arg->max_index = 0; } arg->updates_expected++; @@ -1628,10 +1629,9 @@ static int reftable_be_transaction_finish(struct ref_store *ref_store UNUSED, struct reftable_transaction_data *tx_data = transaction->backend_data; int ret = 0; - if (tx_data->args) - tx_data->args->max_index = transaction->max_index; - for (size_t i = 0; i < tx_data->args_nr; i++) { + tx_data->args[i].max_index = transaction->max_index; + ret = reftable_addition_add(tx_data->args[i].addition, write_transaction_table, &tx_data->args[i]); if (ret < 0)