FILE / ScuroNeko/mtg

mtglib/internal/obfuscation/handshake_frame_fuzz_test.go

Исходный файл и его история в репозитории.
FILE 3db1be068795ac559814234f2f67cb72529be983
Files
mtg/mtglib/internal/obfuscation/handshake_frame_fuzz_test.go
T
2026-02-24 15:27:19 +01:00

41 lines
981 B
Go

package obfuscation
import (
"encoding/binary"
"testing"
"github.com/stretchr/testify/assert"
)
func FuzzGenerateHandshakeFrame(f *testing.F) {
f.Fuzz(func(t *testing.T, arg int16) {
frame := generateHandshake(int(arg))
assert.NotEqualValues(t, 0xef, frame.data[0])
firstBytes := binary.LittleEndian.Uint32(frame.data[:4])
assert.NotEqualValues(t, 0x44414548, firstBytes)
assert.NotEqualValues(t, 0x54534f50, firstBytes)
assert.NotEqualValues(t, 0x20544547, firstBytes)
assert.NotEqualValues(t, 0x4954504f, firstBytes)
assert.NotEqualValues(t, 0x02010316, firstBytes)
assert.NotEqualValues(t, 0xeeeeeeee, firstBytes)
assert.NotEqualValues(t, 0xdddddddd, firstBytes)
assert.NotEqualValues(
t,
0,
frame.data[4]|frame.data[5]|frame.data[6]|frame.data[7])
assert.Equal(t, hfConnectionType[:], frame.connectionType())
if arg < 0 {
arg = -arg
} else if arg == 0 {
arg = defaultDC
}
assert.EqualValues(t, arg, frame.dc())
})
}