0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-03-27 20:00:27 +01:00

Catch scanner error when possible to avoid bypass (#36963)

This commit is contained in:
Lunny Xiao 2026-03-23 21:08:48 -07:00 committed by GitHub
parent c5e196dedb
commit c453d09c36
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -276,6 +276,9 @@ Gitea or set your environment appropriately.`, "")
lastline = 0
}
}
if err := scanner.Err(); err != nil {
return fail(ctx, "Hook failed: stdin read error", "scanner error: %v", err)
}
if count > 0 {
hookOptions.OldCommitIDs = oldCommitIDs[:count]
@ -415,6 +418,11 @@ Gitea or set your environment appropriately.`, "")
count = 0
}
}
if err := scanner.Err(); err != nil {
_ = dWriter.Close()
hookPrintResults(results)
return fail(ctx, "Hook failed: stdin read error", "scanner error: %v", err)
}
if count == 0 {
if wasEmpty && masterPushed {