From: robertlipe Date: Sat, 8 Dec 2012 07:52:13 +0000 (+0000) Subject: Lowranceusr4: don't try to compute date on invalid input. X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~12^2~11^2~744 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=1ca40532d35590ded2bbe92877efbbaa64993652;p=gpsbabel.git Lowranceusr4: don't try to compute date on invalid input. --- diff --git a/gpsbabel/lowranceusr4.c b/gpsbabel/lowranceusr4.c index f83164ccc..7c00c01fe 100644 --- a/gpsbabel/lowranceusr4.c +++ b/gpsbabel/lowranceusr4.c @@ -437,7 +437,14 @@ lowranceusr4_parse_waypoints(void) time is a unix timestamp. */ create_date = gbfgetint32(file_in); create_time = gbfgetint32(file_in); - wpt_tmp->creation_time = lowranceusr4_get_timestamp(create_date, create_time); + + // Julian date 2440487 is 1/1/1970. If that's the date we're working + // with, as a practical matter, we have no date, so don't even compute + // or set it. + if (create_date > 2440587) { + wpt_tmp->creation_time = lowranceusr4_get_timestamp(create_date, + create_time); + } /* Unused byte */ gbfgetc(file_in);