Merge pull request #4682 from Crypt-iQ/fuzz_ret_1009
fuzz: change return values to 1 rather than 0 or -1
This commit is contained in:
commit
9e75c3eade
@ -11,7 +11,7 @@ import (
|
|||||||
func Fuzz_random_actone(data []byte) int {
|
func Fuzz_random_actone(data []byte) int {
|
||||||
// Check if data is large enough.
|
// Check if data is large enough.
|
||||||
if len(data) < brontide.ActOneSize {
|
if len(data) < brontide.ActOneSize {
|
||||||
return -1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// This will return brontide machines with random keys.
|
// This will return brontide machines with random keys.
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
func Fuzz_random_actthree(data []byte) int {
|
func Fuzz_random_actthree(data []byte) int {
|
||||||
// Check if data is large enough.
|
// Check if data is large enough.
|
||||||
if len(data) < brontide.ActThreeSize {
|
if len(data) < brontide.ActThreeSize {
|
||||||
return -1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// This will return brontide machines with random keys.
|
// This will return brontide machines with random keys.
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
func Fuzz_random_acttwo(data []byte) int {
|
func Fuzz_random_acttwo(data []byte) int {
|
||||||
// Check if data is large enough.
|
// Check if data is large enough.
|
||||||
if len(data) < brontide.ActTwoSize {
|
if len(data) < brontide.ActTwoSize {
|
||||||
return -1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// This will return brontide machines with random keys.
|
// This will return brontide machines with random keys.
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
func Fuzz_random_init_enc_dec(data []byte) int {
|
func Fuzz_random_init_enc_dec(data []byte) int {
|
||||||
// Ensure that length of message is not greater than max allowed size.
|
// Ensure that length of message is not greater than max allowed size.
|
||||||
if len(data) > math.MaxUint16 {
|
if len(data) > math.MaxUint16 {
|
||||||
return 0
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// This will return brontide machines with random keys.
|
// This will return brontide machines with random keys.
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
func Fuzz_random_init_encrypt(data []byte) int {
|
func Fuzz_random_init_encrypt(data []byte) int {
|
||||||
// Ensure that length of message is not greater than max allowed size.
|
// Ensure that length of message is not greater than max allowed size.
|
||||||
if len(data) > math.MaxUint16 {
|
if len(data) > math.MaxUint16 {
|
||||||
return 0
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// This will return brontide machines with random keys.
|
// This will return brontide machines with random keys.
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
func Fuzz_random_resp_enc_dec(data []byte) int {
|
func Fuzz_random_resp_enc_dec(data []byte) int {
|
||||||
// Ensure that length of message is not greater than max allowed size.
|
// Ensure that length of message is not greater than max allowed size.
|
||||||
if len(data) > math.MaxUint16 {
|
if len(data) > math.MaxUint16 {
|
||||||
return 0
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// This will return brontide machines with random keys.
|
// This will return brontide machines with random keys.
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
func Fuzz_random_resp_encrypt(data []byte) int {
|
func Fuzz_random_resp_encrypt(data []byte) int {
|
||||||
// Ensure that length of message is not greater than max allowed size.
|
// Ensure that length of message is not greater than max allowed size.
|
||||||
if len(data) > math.MaxUint16 {
|
if len(data) > math.MaxUint16 {
|
||||||
return 0
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// This will return brontide machines with random keys.
|
// This will return brontide machines with random keys.
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
func Fuzz_static_actone(data []byte) int {
|
func Fuzz_static_actone(data []byte) int {
|
||||||
// Check if data is large enough.
|
// Check if data is large enough.
|
||||||
if len(data) < brontide.ActOneSize {
|
if len(data) < brontide.ActOneSize {
|
||||||
return -1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// This will return brontide machines with static keys.
|
// This will return brontide machines with static keys.
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
func Fuzz_static_actthree(data []byte) int {
|
func Fuzz_static_actthree(data []byte) int {
|
||||||
// Check if data is large enough.
|
// Check if data is large enough.
|
||||||
if len(data) < brontide.ActThreeSize {
|
if len(data) < brontide.ActThreeSize {
|
||||||
return -1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// This will return brontide machines with static keys.
|
// This will return brontide machines with static keys.
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
func Fuzz_static_acttwo(data []byte) int {
|
func Fuzz_static_acttwo(data []byte) int {
|
||||||
// Check if data is large enough.
|
// Check if data is large enough.
|
||||||
if len(data) < brontide.ActTwoSize {
|
if len(data) < brontide.ActTwoSize {
|
||||||
return -1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// This will return brontide machines with static keys.
|
// This will return brontide machines with static keys.
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
func Fuzz_static_init_enc_dec(data []byte) int {
|
func Fuzz_static_init_enc_dec(data []byte) int {
|
||||||
// Ensure that length of message is not greater than max allowed size.
|
// Ensure that length of message is not greater than max allowed size.
|
||||||
if len(data) > math.MaxUint16 {
|
if len(data) > math.MaxUint16 {
|
||||||
return 0
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// This will return brontide machines with static keys.
|
// This will return brontide machines with static keys.
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
func Fuzz_static_init_encrypt(data []byte) int {
|
func Fuzz_static_init_encrypt(data []byte) int {
|
||||||
// Ensure that length of message is not greater than max allowed size.
|
// Ensure that length of message is not greater than max allowed size.
|
||||||
if len(data) > math.MaxUint16 {
|
if len(data) > math.MaxUint16 {
|
||||||
return 0
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// This will return brontide machines with static keys.
|
// This will return brontide machines with static keys.
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
func Fuzz_static_resp_enc_dec(data []byte) int {
|
func Fuzz_static_resp_enc_dec(data []byte) int {
|
||||||
// Ensure that length of message is not greater than max allowed size.
|
// Ensure that length of message is not greater than max allowed size.
|
||||||
if len(data) > math.MaxUint16 {
|
if len(data) > math.MaxUint16 {
|
||||||
return 0
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// This will return brontide machines with static keys.
|
// This will return brontide machines with static keys.
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
func Fuzz_static_resp_encrypt(data []byte) int {
|
func Fuzz_static_resp_encrypt(data []byte) int {
|
||||||
// Ensure that length of message is not greater than max allowed size.
|
// Ensure that length of message is not greater than max allowed size.
|
||||||
if len(data) > math.MaxUint16 {
|
if len(data) > math.MaxUint16 {
|
||||||
return 0
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// This will return brontide machines with static keys.
|
// This will return brontide machines with static keys.
|
||||||
|
@ -32,7 +32,7 @@ func Fuzz_accept_channel(data []byte) int {
|
|||||||
payloadLen := uint32(len(data)) - 2
|
payloadLen := uint32(len(data)) - 2
|
||||||
if payloadLen > emptyMsg.MaxPayloadLength(0) {
|
if payloadLen > emptyMsg.MaxPayloadLength(0) {
|
||||||
// Ignore this input - max payload constraint violated.
|
// Ignore this input - max payload constraint violated.
|
||||||
return -1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
msg, err := lnwire.ReadMessage(r, 0)
|
msg, err := lnwire.ReadMessage(r, 0)
|
||||||
@ -40,7 +40,7 @@ func Fuzz_accept_channel(data []byte) int {
|
|||||||
// go-fuzz generated []byte that cannot be represented as a
|
// go-fuzz generated []byte that cannot be represented as a
|
||||||
// wire message but we will return 0 so go-fuzz can modify the
|
// wire message but we will return 0 so go-fuzz can modify the
|
||||||
// input.
|
// input.
|
||||||
return 0
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// We will serialize the message into a new bytes buffer.
|
// We will serialize the message into a new bytes buffer.
|
||||||
|
@ -35,7 +35,7 @@ func harness(data []byte, emptyMsg lnwire.Message) int {
|
|||||||
payloadLen := uint32(len(data)) - 2
|
payloadLen := uint32(len(data)) - 2
|
||||||
if payloadLen > emptyMsg.MaxPayloadLength(0) {
|
if payloadLen > emptyMsg.MaxPayloadLength(0) {
|
||||||
// Ignore this input - max payload constraint violated.
|
// Ignore this input - max payload constraint violated.
|
||||||
return -1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
msg, err := lnwire.ReadMessage(r, 0)
|
msg, err := lnwire.ReadMessage(r, 0)
|
||||||
@ -43,7 +43,7 @@ func harness(data []byte, emptyMsg lnwire.Message) int {
|
|||||||
// go-fuzz generated []byte that cannot be represented as a
|
// go-fuzz generated []byte that cannot be represented as a
|
||||||
// wire message but we will return 0 so go-fuzz can modify the
|
// wire message but we will return 0 so go-fuzz can modify the
|
||||||
// input.
|
// input.
|
||||||
return 0
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// We will serialize the message into a new bytes buffer.
|
// We will serialize the message into a new bytes buffer.
|
||||||
|
@ -32,7 +32,7 @@ func Fuzz_node_announcement(data []byte) int {
|
|||||||
payloadLen := uint32(len(data)) - 2
|
payloadLen := uint32(len(data)) - 2
|
||||||
if payloadLen > emptyMsg.MaxPayloadLength(0) {
|
if payloadLen > emptyMsg.MaxPayloadLength(0) {
|
||||||
// Ignore this input - max payload constraint violated.
|
// Ignore this input - max payload constraint violated.
|
||||||
return -1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
msg, err := lnwire.ReadMessage(r, 0)
|
msg, err := lnwire.ReadMessage(r, 0)
|
||||||
@ -40,7 +40,7 @@ func Fuzz_node_announcement(data []byte) int {
|
|||||||
// go-fuzz generated []byte that cannot be represented as a
|
// go-fuzz generated []byte that cannot be represented as a
|
||||||
// wire message but we will return 0 so go-fuzz can modify the
|
// wire message but we will return 0 so go-fuzz can modify the
|
||||||
// input.
|
// input.
|
||||||
return 0
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// We will serialize the message into a new bytes buffer.
|
// We will serialize the message into a new bytes buffer.
|
||||||
|
@ -32,7 +32,7 @@ func Fuzz_open_channel(data []byte) int {
|
|||||||
payloadLen := uint32(len(data)) - 2
|
payloadLen := uint32(len(data)) - 2
|
||||||
if payloadLen > emptyMsg.MaxPayloadLength(0) {
|
if payloadLen > emptyMsg.MaxPayloadLength(0) {
|
||||||
// Ignore this input - max payload constraint violated.
|
// Ignore this input - max payload constraint violated.
|
||||||
return -1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
msg, err := lnwire.ReadMessage(r, 0)
|
msg, err := lnwire.ReadMessage(r, 0)
|
||||||
@ -40,7 +40,7 @@ func Fuzz_open_channel(data []byte) int {
|
|||||||
// go-fuzz generated []byte that cannot be represented as a
|
// go-fuzz generated []byte that cannot be represented as a
|
||||||
// wire message but we will return 0 so go-fuzz can modify the
|
// wire message but we will return 0 so go-fuzz can modify the
|
||||||
// input.
|
// input.
|
||||||
return 0
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// We will serialize the message into a new bytes buffer.
|
// We will serialize the message into a new bytes buffer.
|
||||||
|
@ -36,7 +36,7 @@ func harness(data []byte, emptyMsg wtwire.Message) int {
|
|||||||
payloadLen := uint32(len(data)) - 2
|
payloadLen := uint32(len(data)) - 2
|
||||||
if payloadLen > emptyMsg.MaxPayloadLength(0) {
|
if payloadLen > emptyMsg.MaxPayloadLength(0) {
|
||||||
// Ignore this input - max payload constraint violated.
|
// Ignore this input - max payload constraint violated.
|
||||||
return -1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
msg, err := wtwire.ReadMessage(r, 0)
|
msg, err := wtwire.ReadMessage(r, 0)
|
||||||
@ -44,7 +44,7 @@ func harness(data []byte, emptyMsg wtwire.Message) int {
|
|||||||
// go-fuzz generated []byte that cannot be represented as a
|
// go-fuzz generated []byte that cannot be represented as a
|
||||||
// wire message but we will return 0 so go-fuzz can modify the
|
// wire message but we will return 0 so go-fuzz can modify the
|
||||||
// input.
|
// input.
|
||||||
return 0
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// We will serialize the message into a new bytes buffer.
|
// We will serialize the message into a new bytes buffer.
|
||||||
|
Loading…
Reference in New Issue
Block a user