Package: gpsbabel
Version: 1.6.0+ds-5
Severity: normal
Tags: patch upstream

I have a device that occasionally seems to forget to initialise parts
of itself.  When it does this, the "garmin_fit" tracks it save aren't
readable by gpsbabel.  Normally they are.  The symptom is:

24874,32> gpsbabel -i garmin_fit -f can\'t-read-00000545.fit -o gpx -F 
/tmp/00000545.gpx
fit: Bad endian field

When run with the attached patch though (which may need to be refined
to perhaps require the user to first set a "ignore_endian_errors"
flag, or just treat it as Situation Normal and just send the output to
the debug logs instead), the output file appears to be entirely valid.
The patch ends up just treating the endian uint8 as a boolean:

--- a/garmin_fit.cc
+++ b/garmin_fit.cc
@@ -253,7 +253,7 @@
   // second byte is endianness
   def->endian = fit_getuint8();
   if (def->endian > 1) {
-    fatal(MYNAME ": Bad endian field\n");
+    warning(MYNAME ": Bad endian field: %d\n",def->endian);
   }
   fit_data.endian = def->endian;


The result I get on my two example files are:

0-0-12:11:01, Thu Aug 22 tconnors@weinberg:~/tracks (bash)
24875,33> gpsbabel -i garmin_fit -f can\'t-read-00000545.fit -o gpx -F 
/tmp/00000545.gpx
fit: Bad endian field: 229
fit: Bad endian field: 186
0-0-12:20:08, Thu Aug 22 tconnors@weinberg:~/tracks (bash)
24876,34> gpsbabel -i garmin_fit -f can\'t-read-00000545-2.fit -o gpx -F 
/tmp/00000545-2.gpx
fit: Bad endian field: 19
fit: Bad endian field: 69


I'll see whether I can upload an example file exhibiting the problem...


-- System Information:
Debian Release: 9.8
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable'), (5, 'testing'), (2, 
'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.19.0-0.bpo.4-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_AU:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages gpsbabel depends on:
ii  libc6         2.28-6
ii  libgcc1       1:8.3.0-6
ii  libqt5core5a  5.11.3+dfsg1-1
ii  libshp2       1.4.0-1
ii  libstdc++6    8.3.0-6
ii  libusb-0.1-4  2:0.1.12-30
ii  zlib1g        1:1.2.8.dfsg-5

Versions of packages gpsbabel recommends:
ii  gpsbabel-doc  1.5.4-2

gpsbabel suggests no packages.

-- no debconf information

Reply via email to