mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
Merge branch 'kn/reftable-writer-log-write-verify'
Reftable backend adds check for upper limit of log's update_index. * kn/reftable-writer-log-write-verify: reftable/writer: ensure valid range for log's update_index
This commit is contained in:
@@ -425,6 +425,18 @@ int reftable_writer_add_log(struct reftable_writer *w,
|
||||
if (log->value_type == REFTABLE_LOG_DELETION)
|
||||
return reftable_writer_add_log_verbatim(w, log);
|
||||
|
||||
/*
|
||||
* Verify only the upper limit of the update_index. Each reflog entry
|
||||
* is tied to a specific update_index. Entries in the reflog can be
|
||||
* replaced by adding a new entry with the same update_index,
|
||||
* effectively canceling the old one.
|
||||
*
|
||||
* Consequently, reflog updates may include update_index values lower
|
||||
* than the writer's min_update_index.
|
||||
*/
|
||||
if (log->update_index > w->max_update_index)
|
||||
return REFTABLE_API_ERROR;
|
||||
|
||||
if (!log->refname)
|
||||
return REFTABLE_API_ERROR;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user