Skip to content

Commit

Permalink
Bug 672760 - Postponed transaction applied invalid date, causing segf…
Browse files Browse the repository at this point in the history
…ault

upon opening data file.
Part 1: Prevent the crash by skipping instances with invalid dates.
  • Loading branch information
jralls committed Jan 11, 2015
1 parent 403fdd3 commit 609ca72
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/gnome-utils/gnc-dense-cal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1736,14 +1736,20 @@ gdc_add_tag_markings(GncDenseCal *cal, guint tag)
{
dates[idx] = g_date_new();
gnc_dense_cal_model_get_instance(cal->model, tag, idx, dates[idx]);
}

if (g_date_get_julian(dates[0]) < g_date_get_julian(calDate))
}
if (g_date_valid(dates[0]))
{
_gnc_dense_cal_set_month(cal, g_date_get_month(dates[0]), FALSE);
_gnc_dense_cal_set_year(cal, g_date_get_year(dates[0]), FALSE);
if (g_date_get_julian(dates[0]) < g_date_get_julian(calDate))
{
_gnc_dense_cal_set_month(cal, g_date_get_month(dates[0]), FALSE);
_gnc_dense_cal_set_year(cal, g_date_get_year(dates[0]), FALSE);
}
}
else
{
g_warning("Bad date, skipped.");
}

gdc_mark_add(cal, tag, name, info, num_marks, dates);

for (idx = 0; idx < num_marks; idx++)
Expand Down

0 comments on commit 609ca72

Please sign in to comment.