nakabonne/ali

Panic when reading StatusCodes map while infinite attack

nakabonne opened this issue · 0 comments

While the likelihood of occurrence has decreased by merging #77, panic still occurs.

Give as:

ali -d 30s -r 0 http://host.xz

Then:

goroutine 37 [running]:                                                    ││                                                                          ││                                                                          │└───────────────────────────────────────────────────────────────────────────┘│                                                                            │
runtime.throw(0x1410c0a, 0x26)                                             ││                                                                          ││                                                                          │┌Errors─────────────────────────────────────────────────────────────────────┐│                                                                            │
│       /opt/hostedtoolcache/go/1.15.3/x64/src/runtime/panic.go:1116 +0x72 fp=0xc015c03b40 sp=0xc015c03b10 pc=0x1034b32                                ││                                                                          ││- Get "http://34.84.111.163:9898": dial tcp 0.0.0.0:0->34.84.111.163:9898: ││                                                                            │
runtime.mapiternext(0xc015c03d40)                                          ││                                                                          ││                                                                          ││socket: too many open files                                                ││                                                                            │
│       /opt/hostedtoolcache/go/1.15.3/x64/src/runtime/map.go:853 +0x554 fp=0xc015c03bc0 sp=0xc015c03b40 pc=0x1010814                                  ││                                                                          ││                                                                           ││                                                                            │
github.com/nakabonne/ali/gui.(*drawer).redrawMetrics(0xc0000b80d0, 0x1476c20, 0xc00009e080)                                                            ││                                                                          ││                                                                           ││                                                                            │
│       /home/runner/work/ali/ali/gui/drawer.go:218 +0x193 fp=0xc015c03fc8 sp=0xc015c03bc0 pc=0x1347373                                                ││                                                                          ││                                                                           ││                                                                            │
runtime.goexit()                                                           ││                                                                          ││                                                                          ││                                                                           ││                                                                            │
│       /opt/hostedtoolcache/go/1.15.3/x64/src/runtime/asm_amd64.s:1374 +0x1 fp=0xc015c03fd0 sp=0xc015c03fc8 pc=0x1068fe1                              ││                                                                          ││                                                                           ││                                                                            │
created by github.com/nakabonne/ali/gui.run                                ││                                                                          ││                                                                          ││                                                                           ││                                                                            │
│       /home/runner/work/ali/ali/gui/gui.go:78 +0x63c

For some reason, there is panic here:

for code, n := range m.StatusCodes {