Skip to content

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

Description

@josharian

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions