Wrong Import date format selection crashes Gnucash

Derek Atkins warlord at MIT.EDU
Mon Dec 12 12:13:13 EST 2016


Hi,

John Ralls <jralls at ceridwen.us> writes:

>> 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.

This begs the question -- why is the UI allowing an invalid choice for
the date format?

The QIF importer tests the dates to attempt to determine the format and
presents the user with possible choices in the event of any ambiguity.
Has that functionality still not been ported to the C code before added
the format selector?

> 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?
>
> Regards,
> John Ralls

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available


More information about the gnucash-devel mailing list