pbogut / recurring_events

Elixir library for dealing with recurring events
MIT License
26 stars 8 forks source link

Some invalid values passed to `take/[2,3]` will crash the VM #17

Closed voughtdq closed 5 years ago

voughtdq commented 5 years ago

When giving a negative value to take/[2,3] like this:

RecurringEvents.take(Date.utc_today(), %{by_day: :monday, freq: :weekly}, -1)

The function will consume resources until it crashes the VM.

The same goes for some invalid values, for example:

RecurringEvents.take(Date.utc_today(), %{by_day: :m, freq: :weekly}, 3)

It's probably best to raise an exception when bad values are provided.

pbogut commented 5 years ago

Fixed in #18