Skip to content

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

2 participants