diff options
| author | Cuong Manh Le <cuong.manhle.vn@gmail.com> | 2022-10-11 11:56:51 +0700 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2022-10-12 00:12:53 +0000 |
| commit | 4bcf94b0232db65ed5df47e0127cdbc8866aec64 (patch) | |
| tree | 38fd232bf504d2891fe89fb3f9ffe05ed2c23dc0 /src/internal/fuzz | |
| parent | e9fd40a866e9e47ba65976d4cfeaeef7eaf76266 (diff) | |
| download | go-4bcf94b0232db65ed5df47e0127cdbc8866aec64.tar.xz | |
all: prevent fakePC overflow on 386 in libfuzzer mode
fakePC uses hash.Sum32, which returns an uint32. However, libfuzzer
trace/hook functions declare fakePC argument as int, causing overflow on
386 archs.
Fixing this by changing fakePC argument to uint to prevent the overflow.
Fixes #56141
Change-Id: I3994c461319983ab70065f90bf61539a363e0a2a
Reviewed-on: https://go-review.googlesource.com/c/go/+/441996
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/internal/fuzz')
| -rw-r--r-- | src/internal/fuzz/trace.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/internal/fuzz/trace.go b/src/internal/fuzz/trace.go index 5e3ccccfad..a15c370063 100644 --- a/src/internal/fuzz/trace.go +++ b/src/internal/fuzz/trace.go @@ -21,15 +21,15 @@ import _ "unsafe" // for go:linkname //go:linkname libfuzzerHookStrCmp runtime.libfuzzerHookStrCmp //go:linkname libfuzzerHookEqualFold runtime.libfuzzerHookEqualFold -func libfuzzerTraceCmp1(arg0, arg1 uint8, fakePC int) {} -func libfuzzerTraceCmp2(arg0, arg1 uint16, fakePC int) {} -func libfuzzerTraceCmp4(arg0, arg1 uint32, fakePC int) {} -func libfuzzerTraceCmp8(arg0, arg1 uint64, fakePC int) {} +func libfuzzerTraceCmp1(arg0, arg1 uint8, fakePC uint) {} +func libfuzzerTraceCmp2(arg0, arg1 uint16, fakePC uint) {} +func libfuzzerTraceCmp4(arg0, arg1 uint32, fakePC uint) {} +func libfuzzerTraceCmp8(arg0, arg1 uint64, fakePC uint) {} -func libfuzzerTraceConstCmp1(arg0, arg1 uint8, fakePC int) {} -func libfuzzerTraceConstCmp2(arg0, arg1 uint16, fakePC int) {} -func libfuzzerTraceConstCmp4(arg0, arg1 uint32, fakePC int) {} -func libfuzzerTraceConstCmp8(arg0, arg1 uint64, fakePC int) {} +func libfuzzerTraceConstCmp1(arg0, arg1 uint8, fakePC uint) {} +func libfuzzerTraceConstCmp2(arg0, arg1 uint16, fakePC uint) {} +func libfuzzerTraceConstCmp4(arg0, arg1 uint32, fakePC uint) {} +func libfuzzerTraceConstCmp8(arg0, arg1 uint64, fakePC uint) {} -func libfuzzerHookStrCmp(arg0, arg1 string, fakePC int) {} -func libfuzzerHookEqualFold(arg0, arg1 string, fakePC int) {} +func libfuzzerHookStrCmp(arg0, arg1 string, fakePC uint) {} +func libfuzzerHookEqualFold(arg0, arg1 string, fakePC uint) {} |
