Skip to content

cron.ParseStandard("TZ=0") causes panic #554

Description

@PersistentJZH

Description

Calling cron.ParseStandard("TZ=0") causes a panic instead of returning an error.

Steps to Reproduce

package main
import "github.com/robfig/cron/v3"

func main() {
    cron.ParseStandard("TZ=0")  // Panics
}

Problem

This is problematic in production environments where:

  • Users provide cron expressions as input
  • A panic can crash the entire service
  • Fuzz testing scenarios can easily trigger this panic

Expected Behavior

can return an error for invalid input instead of panic? like:

parser, err := cron.ParseStandard("TZ=0")
if err != nil {
    return fmt.Errorf("invalid cron expression: %w", err)
}

Environment

  • Go version: 1.21+
  • cron library version: latest
  • OS: macOS m1

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions