cockroachdb/apd

panic with SetString(".-400000000000000000000000000000000000000")

josharian opened this issue · 1 comments

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.)

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.