You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a great library, however there seems to be an issue with the QUICRandomFrames algorithm I am sometimes running into. It throws: panic: crypto/rand: argument to Int is <= 0
I modified the surrounding code blindly to avoid overflows:
lenCryptoData:=uint64(len(cryptoData))
offsetCryptoData:=uint64(0)
fori:=uint64(0); i<numCRYPTO-1; i++ { // select n-1 times, since the last one must be the remaining// randomly select length of CRYPTO frame.// Length must be at least 1 byte and at most the remaining length of cryptoData minus the remaining number of CRYPTO frames.// i.e. len in [1, len(cryptoData)-offsetCryptoData-(numCRYPTO-i-2))log.Printf("lenCryptoData: %d, offsetCryptoData: %d, numCRYPTO: %d, i: %d\n", lenCryptoData, offsetCryptoData, numCRYPTO, i)
remainingCrypto:=lenCryptoData- (numCRYPTO-i-2)
// check if it overflows uint64ifremainingCrypto>0xFFFFFFFF||remainingCrypto==0 {
log.Printf("remainingCrypto overflow: %d\n", remainingCrypto)
break
} else {
log.Printf("remainingCrypto: %d\n", remainingCrypto)
}
lenCRYPTO, err:=cryptoSafeRandUint64(1, remainingCrypto)
iferr!=nil {
returnnil, err
}
frameList=append(frameList, QUICFrameCrypto{Offset: int(offsetCryptoData), Length: int(lenCRYPTO)})
offsetCryptoData+=lenCRYPTOlenCryptoData-=lenCRYPTO
}
And in the problematic case I saw this in the logs:
Hey,
This is a great library, however there seems to be an issue with the
QUICRandomFrames
algorithm I am sometimes running into. It throws:panic: crypto/rand: argument to Int is <= 0
Based on the stacktrace it occurs at this line:
uquic/u_quic_frames.go
Line 253 in 98f5a5d
I modified the surrounding code blindly to avoid overflows:
And in the problematic case I saw this in the logs:
It doesn't always happen, but when it does, the program panics...
The text was updated successfully, but these errors were encountered: