Discard unread data of git cat-file (#29297)

Fixes #29101
Related #29298

Discard all read data to prevent misinterpreting existing data. Some
discard calls were missing in error cases.

---------

Co-authored-by: yp05327 <576951401@qq.com>
This commit is contained in:
KN4CK3Randyp05327 authored and GitHub committed 2024-02-22 03:48:19 +00:00
1 parent c236e64aca
commit d6811baf88
10 files changed
+66 -80

No files matched your search

+4
View File
@@ -169,6 +169,10 @@ func FindLFSFile(repo *git.Repository, objectID git.ObjectID) ([]*LFSResult, err
} else {
break commitReadingLoop
}
default:
if err := git.DiscardFull(batchReader, size+1); err != nil {
return nil, err
}
}
}
}