You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gitea/modules
KN4CK3R f74c869221
Prevent double use of `git cat-file` session. (#29298)
Fixes the reason why #29101 is hard to replicate.
Related #29297

Create a repo with a file with minimum size 4097 bytes (I use 10000) and
execute the following code:
```go
gitRepo, err := gitrepo.OpenRepository(db.DefaultContext, <repo>)
assert.NoError(t, err)

commit, err := gitRepo.GetCommit(<sha>)
assert.NoError(t, err)

entry, err := commit.GetTreeEntryByPath(<file>)
assert.NoError(t, err)

b := entry.Blob()

// Create a reader
r, err := b.DataAsync()
assert.NoError(t, err)
defer r.Close()

// Create a second reader
r2, err := b.DataAsync()
assert.NoError(t, err) // Should be no error but is ErrNotExist
defer r2.Close()
```

The problem is the check in `CatFileBatch`:

79217ea63c/modules/git/repo_base_nogogit.go (L81-L87)
`Buffered() > 0` is used to check if there is a "operation" in progress
at the moment. This is a problem because we can't control the internal
buffer in the `bufio.Reader`. The code above demonstrates a sequence
which initiates an operation for which the code thinks there is no
active processing. The second call to `DataAsync()` therefore reuses the
existing instances instead of creating a new batch reader.
12 months ago
..
actions Implement some action notifier functions (#29173) 12 months ago
activitypub Upgrade to golangci-lint@v1.55.0 (#27756) 1 year ago
analyze Rename code_langauge.go to code_language.go (#26377) 2 years ago
assetfs Use `Set[Type]` instead of `map[Type]bool/struct{}`. (#26804) 1 year ago
auth Refactor locale&string&template related code (#29165) 12 months ago
avatar Remove nfnt/resize and oliamb/cutter (#25999) 2 years ago
base Use general token signing secret (#29205) 12 months ago
cache Always enable caches (#28527) 1 year ago
charset Refactor locale&string&template related code (#29165) 12 months ago
container
context Remove DataRaceCheck (#29258) 12 months ago
contexttest Improve user experience for outdated comments (#29050) 12 months ago
csv Refactor locale&string&template related code (#29165) 12 months ago
emoji Update emoji set to Unicode 15 (#25595) 2 years ago
eventsource Final round of `db.DefaultContext` refactor (#27587) 1 year ago
generate Refactor JWT secret generating & decoding code (#29172) 12 months ago
git Prevent double use of `git cat-file` session. (#29298) 12 months ago
gitgraph More `db.DefaultContext` refactor (#27265) 1 year ago
gitrepo Simplify how git repositories are opened (#28937) 1 year ago
graceful Suggest to use Type=simple for systemd service (#28717) 1 year ago
hcaptcha
highlight Add option to disable ambiguous unicode characters detection (#28454) 1 year ago
hostmatcher Support allowed hosts for webhook to work with proxy (#27655) 1 year ago
html Refactor backend SVG package and add tests (#26335) 2 years ago
httpcache Also match weakly validated ETags (#28957) 1 year ago
httplib Less naked returns (#25713) 2 years ago
indexer fix: Elasticsearch: Request Entity Too Large #28117 (#29062) 12 months ago
issue/template Replace `interface{}` with `any` (#25686) 2 years ago
json Replace `interface{}` with `any` (#25686) 2 years ago
label Make label templates have consistent behavior and priority (#23749) 2 years ago
lfs Update tool dependencies (#29030) 1 year ago
log Reduce some allocations in type conversion (#26772) 1 year ago
markup Refactor markup rendering to accept general "protocol:" prefix (#29276) 12 months ago
mcaptcha
metrics Reduce usage of `db.DefaultContext` (#27073) 1 year ago
migration Refactor locale&string&template related code (#29165) 12 months ago
nosql Update tool dependencies, lock govulncheck and actionlint (#25655) 2 years ago
optional Unify user update methods (#28733) 1 year ago
options Use a general approach to access custom/static/builtin assets (#24022) 2 years ago
packages Propagate install_if and provider_priority to APKINDEX (#28899) 1 year ago
paginator Use more specific test methods (#24265) 2 years ago
pprof
private Return `responseText` instead of string in some functions (#28836) 1 year ago
process Replace assert.Fail with assert.FailNow (#27578) 1 year ago
proxy
proxyprotocol
public Refactor CORS handler (#28587) 1 year ago
queue Increase queue length (#27555) 1 year ago
recaptcha
references Add support for sha256 repositories (#23894) 1 year ago
regexplru Upgrade go dependencies (#25819) 2 years ago
repository Always write proc-receive hook for all git versions (#29287) 12 months ago
secret Improve decryption failure message (#24573) 2 years ago
session Next round of `db.DefaultContext` refactor (#27089) 1 year ago
setting Use general token signing secret (#29205) 12 months ago
sitemap
ssh Remove SSH workaround (#27893) 1 year ago
storage Fix object storage path handling (#27024) 1 year ago
structs Add merge style `fast-forward-only` (#28954) 12 months ago
svg Refactor backend SVG package and add tests (#26335) 2 years ago
sync
system Replace more db.DefaultContext (#27628) 1 year ago
templates Refactor more code in templates (#29236) 12 months ago
test Move web/api context related testing function into a separate package (#26859) 1 year ago
testlogger Replace `interface{}` with `any` (#25686) 2 years ago
timeutil Refactor locale&string&template related code (#29165) 12 months ago
translation Improve TrHTML and add more tests (#29228) 12 months ago
turnstile
typesniffer Detect ogg mime-type as audio or video (#26494) 1 year ago
updatechecker Replace more db.DefaultContext (#27628) 1 year ago
upload
uri
user
util Refactor JWT secret generating & decoding code (#29172) 12 months ago
validation Check blocklist for emails when adding them to account (#26812) 1 year ago
web Refactor locale&string&template related code (#29165) 12 months ago
webhook Fix schedule tasks bugs (#28691) 1 year ago