go-fuzz icon indicating copy to clipboard operation
go-fuzz copied to clipboard

/snap/go/10489/src/crypto/internal/bigmod/nat_asm.go:21: misplaced compiler directive

Open yqiao18 opened this issue 1 year ago • 13 comments

When I ran go-fuzz-build, I encountered this problem: failed to execute go build: exit status 1

crypto/internal/bigmod

/snap/go/10489/src/crypto/internal/bigmod/nat_asm.go:21: misplaced compiler directive Is this because the go that my program is using does not match the go that installed on my machine?

yqiao18 avatar Feb 12 '24 23:02 yqiao18

这是来自QQ邮箱的假期自动回复邮件。您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

wulie avatar Feb 12 '24 23:02 wulie

i just pushed a few commits that should help with this. please make sure you've got the very latest version of go-fuzz and try again. if that doesn't work, please provide a public-code-only complete fuzz file that doesn't build. thanks.

josharian avatar Feb 13 '24 01:02 josharian

Hello, Is this command to get the latest version of go-fuzz? go install github.com/dvyukov/go-fuzz/go-fuzz@latest github.com/dvyukov/go-fuzz/go-fuzz-build@latest Should I run this command inside the package which I wanna fuzz?

yqiao18 avatar Feb 13 '24 02:02 yqiao18

go install github.com/dvyukov/go-fuzz/go-fuzz@latest github.com/dvyukov/go-fuzz/go-fuzz-build@latest

that should work

you should be able to run it anywhere 

josharian avatar Feb 13 '24 17:02 josharian

I still get the same problem. "misplaced compiler directive"

yqiao18 avatar Feb 13 '24 18:02 yqiao18

if that doesn't work, please provide a public-code-only complete fuzz file that doesn't build.

josharian avatar Feb 13 '24 18:02 josharian

package integration

import ( "crypto/x509" )

func Fuzz(data []byte) int { // Call the function you want to fuzz, e.g., x509.ParseCertificateRequest _, err := x509.ParseCertificateRequest(data) if err != nil { return 0 // Tell go-fuzz this input didn't trigger a panic } return 1 // This input is interesting } I can successfully run the go-fuzz github's example, but cannot run the above code

yqiao18 avatar Feb 13 '24 19:02 yqiao18

sigh. i've fixed this bug so many times in so many ways. i'll look again next time i have the heart to. if you want to tackle it yourself, take a look at https://github.com/dvyukov/go-fuzz/commit/73561758e7c363db8926a4819da2f5a15ccc2f39 and https://github.com/dvyukov/go-fuzz/commit/b1ce7bc07150b190caefe82a3313a3a0a23aff6d -- the fix is very likely to be similar, and in the same area of code.

josharian avatar Feb 14 '24 19:02 josharian

The fix your provided to me is already there in the latest version of go-fuzz. However, I still have the same error: /usr/local/go/src/crypto/internal/bigmod/nat_asm.go:21: misplaced compiler directive

Should I change the go-fuzz version to 1.14?

yqiao18 avatar Mar 04 '24 19:03 yqiao18

这是来自QQ邮箱的假期自动回复邮件。您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

wulie avatar Mar 04 '24 19:03 wulie

I'm getting the same bug with the following latest versions

go.sum: github.com/dvyukov/go-fuzz v0.0.0-20240203152606-b1ce7bc07150 h1:8ww/RtfHmtJSLk7nK/TspKZDdgDvvXwp0JMIIhJF35s= github.com/dvyukov/go-fuzz v0.0.0-20240203152606-b1ce7bc07150/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw=

go install github.com/dvyukov/go-fuzz/go-fuzz@latest github.com/dvyukov/go-fuzz/go-fuzz-build@latest

$ ~/go/bin/go-fuzz-build failed to execute go build: exit status 1

crypto/internal/bigmod

/usr/local/go/src/crypto/internal/bigmod/nat_asm.go:21: misplaced compiler directive

hrissan avatar Apr 04 '24 08:04 hrissan

这是来自QQ邮箱的假期自动回复邮件。您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

wulie avatar Apr 04 '24 08:04 wulie

There is an workaround. You can avoid transpiling module in question.

$ ~/go/bin/go-fuzz-build -preserve crypto/internal/bigmod

hrissan avatar Apr 11 '24 06:04 hrissan