Skip to content
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

panic with SetString(".-400000000000000000000000000000000000000") #120

Open
josharian opened this issue Jun 17, 2022 · 2 comments
Open

panic with SetString(".-400000000000000000000000000000000000000") #120

josharian opened this issue Jun 17, 2022 · 2 comments

Comments

@josharian
Copy link
Contributor

This test panics:

func TestSetStringMalformed(t *testing.T) {
	c := &BaseContext
	d := new(Decimal)
	tests := []string{
		".-4",
		".-400000000000000000000000000000000000000",
	}
	for _, test := range tests {
		_, _, err := c.SetString(d, test)
		if err == nil {
			t.Errorf("expected error for SetString(%q)", test)
		}
	}
}

The panic is in the second test case. Also, I think ".-4" should yield an error (the first test case).


This was found (indirectly) by go-fuzz. Would there be interest in adding a fuzz function or three directly? (I don't have much time to dedicate to this, but I can at least give it a nudge, and/or continue my indirect fuzzing.)

@nvanbenschoten
Copy link
Member

Would there be interest in adding a fuzz function or three directly?

Yes, any contribution (large or small) to improve the testing of this library would be appreciated.

@odeke-em
Copy link

I also just re-discovered this panic while fuzzing gnolang/gnovm with apd.Decimal.UnmarshalText

v := new(apd.Decimal)
in := []byte(".-700000000000000000000000000000000000000")
_ = v.UnmarshalText(in)

Kind cc @jaekwon

odeke-em added a commit to odeke-em/gno that referenced this issue Oct 16, 2024
This change adds fuzzers with the purpose of
finding and exorcizing the gnovm to improve
security and reliability.

So far we've already rediscovered a cockroadch/apd/v3 bug
per cockroachdb/apd#120 (comment)
odeke-em added a commit to odeke-em/gno that referenced this issue Oct 16, 2024
This change adds fuzzers with the purpose of
finding and exorcizing the gnovm to improve
security and reliability.

So far we've already rediscovered a cockroadch/apd/v3 bug
per cockroachdb/apd#120 (comment)
odeke-em added a commit to odeke-em/gno that referenced this issue Oct 27, 2024
This change adds fuzzers with the purpose of
finding and exorcizing the gnovm to improve
security and reliability.

So far we've already rediscovered a cockroadch/apd/v3 bug
per cockroachdb/apd#120 (comment)
odeke-em added a commit to odeke-em/gno that referenced this issue Dec 29, 2024
This change adds fuzzers with the purpose of
finding and exorcizing the gnovm to improve
security and reliability.

So far we've already rediscovered a cockroadch/apd/v3 bug
per cockroachdb/apd#120 (comment)
odeke-em added a commit to odeke-em/gno that referenced this issue Jan 8, 2025
…gDecToFloat

To harden the security of Gno, this change introduces fuzzers
that so far have already rediscovered a cockroadch/apd/v3 bug
per cockroachdb/apd#120 (comment)

Updates  gnolang#3087
odeke-em added a commit to odeke-em/gno that referenced this issue Jan 8, 2025
…DecToFloat

To harden the security of Gno, this change introduces fuzzers
that so far have already rediscovered a cockroadch/apd/v3 bug
per cockroachdb/apd#120 (comment)

Updates  gnolang#3087
odeke-em added a commit to odeke-em/gno that referenced this issue Jan 8, 2025
…DecToFloat

To harden the security of Gno, this change introduces fuzzers
that so far have already rediscovered a cockroadch/apd/v3 bug
per cockroachdb/apd#120 (comment)

Updates  gnolang#3087
odeke-em added a commit to odeke-em/gno that referenced this issue Jan 8, 2025
…DecToFloat

To harden the security of Gno, this change introduces fuzzers
that so far have already rediscovered a cockroadch/apd/v3 bug
per cockroachdb/apd#120 (comment)

Updates  gnolang#3087
odeke-em added a commit to odeke-em/gno that referenced this issue Jan 8, 2025
…DecToFloat

To harden the security of Gno, this change introduces fuzzers
that so far have already rediscovered a cockroadch/apd/v3 bug
per cockroachdb/apd#120 (comment)

Updates  gnolang#3087
n2p5 added a commit to gnolang/gno that referenced this issue Jan 9, 2025
…DecToFloat (#3455)

To harden the security of Gno, this change introduces fuzzers that so
far have already rediscovered a cockroadch/apd/v3 bug per
cockroachdb/apd#120 (comment)

Updates  #3087

Co-authored-by: Nathan Toups <[email protected]>
albttx pushed a commit to gnolang/gno that referenced this issue Jan 10, 2025
…DecToFloat (#3455)

To harden the security of Gno, this change introduces fuzzers that so
far have already rediscovered a cockroadch/apd/v3 bug per
cockroachdb/apd#120 (comment)

Updates  #3087

Co-authored-by: Nathan Toups <[email protected]>
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

No branches or pull requests

3 participants