mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-11 02:59:34 -06:00
go/store/datas: FindCommonAncestor: Fix potential for explosive growth if RefsByHeight queues if the same references are visited multiple times.
This commit is contained in:
@@ -108,7 +108,14 @@ func FindCommonAncestor(ctx context.Context, c1, c2 types.Ref, vr types.ValueRea
|
||||
}
|
||||
|
||||
func parentsToQueue(ctx context.Context, refs types.RefSlice, q *types.RefByHeight, vr types.ValueReader) error {
|
||||
seen := make(map[hash.Hash]bool)
|
||||
for _, r := range refs {
|
||||
if _, ok := seen[r.TargetHash()]; ok {
|
||||
continue
|
||||
} else {
|
||||
seen[r.TargetHash()] = true
|
||||
}
|
||||
|
||||
v, err := r.TargetValue(ctx, vr)
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user