| 1 |
Forwarded: https://github.com/google/gofuzz/pull/59/changes |
| 2 |
From: =?utf-8?q?Robert-Andr=C3=A9_Mauchin?= |
| 3 |
<[email protected]> |
| 4 |
Date: Tue, 5 Jan 2021 18:40:07 -0500 |
| 5 |
Subject: Fix int overflow on 32 bits systems (#59) |
| 6 |
MIME-Version: 1.0 |
| 7 |
Content-Type: text/plain; charset="utf-8" |
| 8 |
Content-Transfer-Encoding: 8bit |
| 9 |
|
| 10 |
Fix #58 |
| 11 |
|
| 12 |
Signed-off-by: Robert-André Mauchin <[email protected]> |
| 13 |
--- |
| 14 |
bytesource/bytesource_test.go | 4 ++-- |
| 15 |
fuzz_test.go | 4 ++-- |
| 16 |
2 files changed, 4 insertions(+), 4 deletions(-) |
| 17 |
|
| 18 |
diff --git a/bytesource/bytesource_test.go b/bytesource/bytesource_test.go |
| 19 |
index 609cf5e..e1a8f54 100644 |
| 20 |
--- a/bytesource/bytesource_test.go |
| 21 |
+++ b/bytesource/bytesource_test.go |
| 22 |
@@ -91,9 +91,9 @@ func TestByteSourceValues(t *testing.T) { |
| 23 |
|
| 24 |
r := rand.New(New(data)) |
| 25 |
|
| 26 |
- got := []int{r.Int(), r.Int(), r.Int(), r.Int(), r.Int()} |
| 27 |
+ got := []int64{r.Int63(), r.Int63(), r.Int63(), r.Int63(), r.Int63()} |
| 28 |
|
| 29 |
- want := []int{ |
| 30 |
+ want := []int64{ |
| 31 |
3568552425102051206, |
| 32 |
3568552489526560135, |
| 33 |
3568569467532292485, |
| 34 |
diff --git a/fuzz_test.go b/fuzz_test.go |
| 35 |
index 0a3b771..4bbffe4 100644 |
| 36 |
--- a/fuzz_test.go |
| 37 |
+++ b/fuzz_test.go |
| 38 |
@@ -635,10 +635,10 @@ func TestNewFromGoFuzz(t *testing.T) { |
| 39 |
|
| 40 |
input := []byte{1, 2, 3} |
| 41 |
|
| 42 |
- var got int |
| 43 |
+ var got int64 |
| 44 |
NewFromGoFuzz(input).Fuzz(&got) |
| 45 |
|
| 46 |
- if want := 5563767293437588600; want != got { |
| 47 |
+ if want := int64(5563767293437588600); want != got { |
| 48 |
t.Errorf("Fuzz(%q) = %d, want: %d", input, got, want) |
| 49 |
} |
| 50 |
} |