Skip to content

Couple of panic bugs #1

@gracedo

Description

@gracedo

Getting panics at https://github.com/pbnjay/strptime/blob/master/strptime.go#L104 and https://github.com/pbnjay/strptime/blob/master/strptime.go#L111i when testing all kinds of bad format strings.
First panic slice bounds out of range happens when I test with format=invalid format with input of something like 12/12/17 -- or format strings with prefixes that are longer than the input strings. Should add some length checks of the input and format here before moving on. e.g. return error if len(ps) > len(value)
Second panic index out of range happens with format = %, %%, %%i etc. Probably just need to add a len check for ps before grabbing ps[0] and return an error if it's empty?

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