Skip to content

Commit

Permalink
Handle headers with CRC
Browse files Browse the repository at this point in the history
  • Loading branch information
tfheen committed May 12, 2013
1 parent d0409b8 commit fa3457d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/turan/fitparser.py
Expand Up @@ -254,7 +254,11 @@ def parse_uploaded_file(self, f):
local_msg_types = {}
hdr = f.read(12)
(hdr_size,proto_ver,prof_ver,data_size) = struct.unpack('BBHI',hdr[0:8])
data_type = hdr[8:]
if hdr_size > 12:
# XXX: Maybe do something sensible with this. Ensures we
# handle FIT files with optional CRC at least.
f.read(hdr_size - 12)
data_type = hdr[8:12]

if data_type != '.FIT':
return
Expand Down

0 comments on commit fa3457d

Please sign in to comment.