Skip to content

fix/fuzz: output int32(v)/rune(q) in failing log #58827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hitzhangjie
Copy link
Contributor

@hitzhangjie hitzhangjie commented Mar 2, 2023

When fuzz testing outputs failing input into testdata/, it needs to
marshal the input, In go, int32 and rune are the same datatype, so it
cannot differentiate the two types in typeswitch.

Before, when the data is a valid unicode point, it will outputs rune(%q)
in the log, but the real datatype maybe a int32. In this case, we have
to query the ASCII or unicode table to get the int32 value. It's
inconvenient.

So, here we output int32(%v)/rune(%q) to solve this.

Fixes #58824.

When fuzz testing outputs failing input into testdata/<log>, it needs to
marshal the input, In go, int32 and rune are the same datatype, so it
cannot differentiate the two types in typeswitch.

Before, when the data is a valid unicode point, it will outputs `rune(%q)`
in the log, but the real datatype maybe a int32. In this case, we have
to query the ASCII or unicode table to get the int32 value. It's
inconvenient.

So, here we output `int32(%v)/rune(%q)` to solve this.

close golang#58824
@gopherbot
Copy link
Contributor

This PR (HEAD: a38e4ec) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/472815 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

internal/fuzz: go test -fuzz= outputs failing input which contains wrong datatypes
2 participants