[m-rev.] for review: overflow checks for string conversions in the calendar module

Zoltan Somogyi zoltan.somogyi at runbox.com
Sat Aug 15 03:37:45 AEST 2026



On Sat, 15 Aug 2026 03:34:18 +1000, Julien Fischer <juliensf at gmail.com> wrote:
> On Sat, 15 Aug 2026 at 02:43, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
> > If so, reword the top of the commit message.
> 
> How's this?
> 
> The string to integer conversion predicates used by date_time_from_string/2
> and duration_from_string/2 do not currently detect overflow and wrap around
> while building up the integer values of date_time or duration components;
> add the missing overflow checks.

That's fine.

> > > +    % A test case intended to defeat incorrect overflow checks.
> > > +    dt_conv_test("bad overflow check",
> > > +        "23058430092136939520-01-01 00:00:00")
> > >  ].
> >
> > I don't know what kind of incorrectness you are checking for here,
> > because I don't know what that huge integer is in relation to max_int
> > for 64 bits.
> 
> It's a value that defeats the old incorrect overflow check that
> string.to_int used.

Please add that to the test case code as a comment.

> > Wouldn't even 13 be an overflow in the months, 32 in the days component,
> > etc?
> 
> Not in the sense of integer overflow.
> 
> > Are those tests missing?
> 
> Those tests are present.

Then commit away.

Zoltan.


More information about the reviews mailing list