After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 510940 - Unrecognized date format causes crash
Unrecognized date format causes crash
Status: VERIFIED FIXED
Product: GnuCash
Classification: Other
Component: Import - QIF
2.2.x
Other All
: Normal critical
: ---
Assigned To: Derek Atkins
Derek Atkins
Depends on:
Blocks: backport
 
 
Reported: 2008-01-21 02:24 UTC by Charles Day
Modified: 2018-07-02 07:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
QIF to reproduce the bug (137 bytes, text/plain)
2008-01-21 02:26 UTC, Charles Day
  Details
Proposed patch (2.76 KB, patch)
2008-01-21 02:32 UTC, Charles Day
none Details | Review
Proposed patch (526 bytes, patch)
2008-01-21 03:06 UTC, Charles Day
committed Details | Review

Description Charles Day 2008-01-21 02:24:03 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:
Comment 1 Charles Day 2008-01-21 02:26:03 UTC
Created attachment 103300 [details]
QIF to reproduce the bug

The key here is the date format shown on the "D" line.
Comment 2 Charles Day 2008-01-21 02:32:05 UTC
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".
Comment 3 Charles Day 2008-01-21 02:45:21 UTC
Whoops, attached the wrong patch (this one is for a different bug). Will post a revised patch soon.
Comment 4 Charles Day 2008-01-21 03:06:32 UTC
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.)
Comment 5 Derek Atkins 2008-01-21 14:31:51 UTC
*** Bug 339892 has been marked as a duplicate of this bug. ***
Comment 6 Josh Sled 2008-02-01 00:54:05 UTC
r16905, awaiting backport for 2.2.4.
Thanks!
Comment 7 Andreas Köhler 2008-02-03 02:19:06 UTC
Applied to branches/2.2 as r16916 for GnuCash 2.2.4.
Thanks a lot!
Comment 8 John Ralls 2018-06-29 22:00:00 UTC
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.