Thanks to visit codestin.com
Credit goes to github.com

Skip to content

The fingerprint processor incorrectly includes a function reference in a json.Marshal call #35174

@faec

Description

@faec

The fingerprint.String function here:

func (p *fingerprint) String() string {
	json, _ := json.Marshal(p.config)
	return procName + "=" + string(json)
}

calls json.Marshal on a config struct that includes the field Method hashMethod, with the definition type hashMethod func() hash.Hash. Marshalling function references isn't supported and will probably behave in unexpected/undesirable ways. In fingerprint/hash.go there is a lookup table mapping strings to hashMethods, and this string form is probably what is intended, so either the Marshal call should be changed or the Config struct should use a more marshal-friendly wrapper for its hash method.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions