GNOME Bugzilla – Bug 510940
Unrecognized date format causes crash
Last modified: 2018-07-02 07:25:22 UTC
Steps to reproduce: 1. Attempt to import the attached QIF file Stack trace: The crash is caused in Scheme code. Backtrace: In unknown file: ?: 0* [qif-file:parse-fields #] In c:/soft/gnucash/inst/share/gnucash/scm/qif-import/qif-file.scm: 503: 1* (let* (# # # #) (and # # # ...) (cond # #)) 518: 2* (and # # # ...) 559: 3* [check-and-parse-field #<procedure qif-xtn:date #> ...] 649: 4 (let (# # #) (if # #) (cond # # #) ...) 677: 5* (cond (# # # #) (# #) (#t #)) 682: 6* (and (not (null? (cdr formats))) do-parsing) 682: 7* [not ... 682: 8* [null? ... 682: 9* [cdr #f] c:/soft/gnucash/inst/share/gnucash/scm/qif-import/qif-file.scm:682:24: In proced ure cdr in expression (cdr formats): c:/soft/gnucash/inst/share/gnucash/scm/qif-import/qif-file.scm:682:24: Wrong typ e argument in position 1: #f Other information:
Created attachment 103300 [details] QIF to reproduce the bug The key here is the date format shown on the "D" line.
Created attachment 103301 [details] [review] Proposed patch The default return value of the date format checking procedure, qif-parse:parse-date/format, was wrong. If the date does not match any known formats, it should return #f like all the other format checking procedures. I also corrected a few places in comments and "display" text where the procedure was incorrectly referred to as "qif-parse:parse-date-format".
Whoops, attached the wrong patch (this one is for a different bug). Will post a revised patch soon.
Created attachment 103302 [details] [review] Proposed patch Here is the revised patch. The format checker's return value of #f was not being checked with adequately safety. The date format checker probably should have returned an empty list instead of #f. This change prevents crashing that could be caused by any format checker that returns #f instead of an empty list. (As an aside, the previously submitted patch referred to changes made to the format checker when in fact it was changes to the date parser. That patch is for a different problem and should be ignored.)
*** Bug 339892 has been marked as a duplicate of this bug. ***
r16905, awaiting backport for 2.2.4. Thanks!
Applied to branches/2.2 as r16916 for GnuCash 2.2.4. Thanks a lot!
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=510940. Please update any external references or bookmarks.