Wrong Import date format selection crashes Gnucash
14ubobit at gmail.com
Sun Dec 11 18:33:39 EST 2016
Bad choice of words I guess, I knew I was passing the wrong date
information deliberately to prove I would get an error but wasn't sure how
to stop the crash when that happens. Any way Geert has advised that I
should look at his work for a new date parser which I will do.
On 11 December 2016 at 20:20, John Ralls <jralls at ceridwen.us> wrote:
> > On Dec 11, 2016, at 11:32 AM, Robert Fewell <14ubobit at gmail.com> wrote:
> > #15 0x00007ffff6c2431f in gnc_dmy2timespec_neutral (day=day at entry=2016,
> > month=month at entry=12, year=year at entry=2001)
> The problem seems pretty obvious...
> > at gnc-date.cpp:1251
> > ---Type <return> to continue, or q <return> to quit---
> > #16 0x00007fffe038564d in parse_date_with_year (format=<optimized out>,
> > date_str=0x11f1220 "2016/12/01") at gnc-csv-model.c:212
> > #17 parse_date (date_str=0x11f1220 "2016/12/01", format=1) at
> > gnc-csv-model.c:304
> Here you're telling parse_date_with_year to use "d-m-y" with a y-m-d
> format, and so passing an invalid day to gnc_dmy2rimespec_neutral.
> I suspect that this is what led Geert to ask about invalid date values a
> few weeks ago. We don't want exceptions to leak out of C++ modules, so
> gnc_dmy2timespec_neutral (and every other call to a constructor in
> gnu-date.cpp) should be inside a try-catch block and catch should return an
> invalid result; callers should test for that result. C++ code should use
> GncDateTime directly and handle the exception.
> Aaron, are you still working on replacing Timespec with time64?
> John Ralls
More information about the gnucash-devel