Skip to content

Commit 5a6bf53

Browse files
committed
Fix deadlock on huge input #435
1 parent 55746d2 commit 5a6bf53

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ require (
4141
github.com/minio/minlz v1.0.1 // indirect
4242
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
4343
github.com/modern-go/reflect2 v1.0.2 // indirect
44-
github.com/nwaples/rardecode/v2 v2.2.0 // indirect
44+
github.com/nwaples/rardecode/v2 v2.1.1 // indirect
4545
github.com/pierrec/lz4/v4 v4.1.22 // indirect
4646
github.com/pkg/errors v0.9.1 // indirect
4747
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
131131
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
132132
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
133133
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
134-
github.com/nwaples/rardecode/v2 v2.2.0 h1:4ufPGHiNe1rYJxYfehALLjup4Ls3ck42CWwjKiOqu0A=
135-
github.com/nwaples/rardecode/v2 v2.2.0/go.mod h1:7uz379lSxPe6j9nvzxUZ+n7mnJNgjsRNb6IbvGVHRmw=
134+
github.com/nwaples/rardecode/v2 v2.1.1 h1:OJaYalXdliBUXPmC8CZGQ7oZDxzX1/5mQmgn0/GASew=
135+
github.com/nwaples/rardecode/v2 v2.1.1/go.mod h1:7uz379lSxPe6j9nvzxUZ+n7mnJNgjsRNb6IbvGVHRmw=
136136
github.com/pierrec/lz4/v4 v4.1.22 h1:cKFw6uJDK+/gfw5BcDL0JL5aBsAFdsIT18eRtLj7VIU=
137137
github.com/pierrec/lz4/v4 v4.1.22/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
138138
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=

pkg/csprecon/csprecon.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,17 @@ func New(options *input.Options) Runner {
5858
}
5959

6060
func (r *Runner) Run() {
61-
r.InWg.Add(1)
61+
r.OutWg.Add(1)
6262

63-
go pushInput(r)
63+
go pullOutput(r)
6464

6565
r.InWg.Add(1)
6666

6767
go execute(r)
6868

69-
r.OutWg.Add(1)
69+
r.InWg.Add(1)
7070

71-
go pullOutput(r)
71+
go pushInput(r)
7272

7373
r.InWg.Wait()
7474

@@ -150,7 +150,7 @@ func execute(r *Runner) {
150150
if err != nil {
151151
gologger.Error().Msgf("%s", err)
152152

153-
return
153+
continue
154154
}
155155

156156
rl.Take()
@@ -159,7 +159,7 @@ func execute(r *Runner) {
159159
if err != nil {
160160
gologger.Error().Msgf("%s", err)
161161

162-
return
162+
continue
163163
}
164164

165165
result, err := CheckCSP(targetURL, r.UserAgent, dregex, client)
@@ -168,7 +168,7 @@ func execute(r *Runner) {
168168
gologger.Error().Msgf("%s", err)
169169
}
170170

171-
return
171+
continue
172172
}
173173

174174
if r.Options.JSON {

0 commit comments

Comments
 (0)