Skip to content

json.Number issue #46

@grv99

Description

@grv99

The strings obfuscator currently breaks for json.Number symbols.

Ex. https://github.com/auto-program/vendor/blob/9351d5081b8149a1d03a783dae10cf054146ed16/github.com/gocraft/dbr/types.go#L106

// UnmarshalJSON correctly deserializes a NullInt64 from JSON
func (n *NullInt64) UnmarshalJSON(b []byte) error {
	var s json.Number
	if err := json.Unmarshal(b, &s); err != nil {
		return err
	}
	if s == "" {
		return n.Scan(nil)
	}
	return n.Scan(s)
}
func (n *NullInt64) UnmarshalJSON(b []byte) error {
	var s json.Number
	if err := json.Unmarshal(b, &s); err != nil {
		return err
	}
	if s == (func() string {
mask := []byte("")
maskedStr := []byte("")
res := make([]byte, 0)
        for i, m := range mask {
            res[i] = m ^ maskedStr[i]
        }
        return string(res)
        }()) {
		return n.Scan(nil)
	}
	return n.Scan(s)
}

cannot compare s == ((func() string literal)()) (mismatched types json.Number and string)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions