File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 11package quic
22
33import (
4+ "context"
45 "crypto"
56 "crypto/aes"
67 "crypto/tls"
4647 errNotQuicInitial = errors .New ("not initial packet" )
4748)
4849
49- func SniffQUIC (b []byte ) (* SniffHeader , error ) {
50+ func SniffQUIC (b []byte ) (resultReturn * SniffHeader , errorReturn error ) {
51+ // In extremely rare cases, this sniffer may cause slice error
52+ // and we set recover() here to prevent crash.
53+ // TODO: Thoroughly fix this panic
54+ defer func () {
55+ if r := recover (); r != nil {
56+ errors .LogError (context .Background (), "Failed to sniff QUIC: " , r )
57+ resultReturn = nil
58+ errorReturn = common .ErrNoClue
59+ }
60+ }()
61+
5062 // Crypto data separated across packets
5163 cryptoLen := 0
5264 cryptoData := bytespool .Alloc (int32 (len (b )))
You can’t perform that action at this time.
0 commit comments