Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

FIT file crashes cpp SDK

Rank

Total Posts: 1

Joined 2013-05-25

PM

I have a .fit file that crashes the cpp version of the FIT_SDK while either using fit::Decode::Read() or fit::Decode::CheckIntegrity(). Will someone help troubleshoot and help me with a patch that will deal with the error gracefully?

I'll send the file by e-mail separately if someone will have a look. It's easy to reproduce using the command line utility in FitSDKRelease_20/cpp/examples/decodeMac. In the debugger I get an EXC_BAD_ACCESS here:

FIT_UINT8 DeveloperFieldDefinition::GetSize() const
{
    
return size



when because this is null when called from fit_decode.cpp line 873:

case STATE_DEV_FIELD_DATA{
             MesgDefinition
localMesgDef localMesgDefs[localMesgIndex];
             
DeveloperFieldDefinitionfieldDef localMesgDef.GetDevFieldByIndex(fieldIndex);

             if (
fieldBytesLeft == 0)
             
{
                 fieldDataIndex 
0;
                 
fieldBytesLeft fieldDef->GetSize();

                 if (
fieldBytesLeft == 0)
                 
{
                     fieldBytesLeft 
localMesgDefs->
                         
GetDevFieldByIndex(++fieldIndex)->GetSize();   <---- line 873 
     
Rank

Total Posts: 7

Joined 2017-02-08

PM

I'm developing myself but I don't have access to a Mac station. Currently I'm using Linux/gcc.

I think it would be wise to include a backtrace. Does this happen only at a specific .fit file?
Please send it to me so I can check. I'm building a decoder myself, so it shouldn't take too much effort for me to check.

I doubt whether it's Getsize() that produces the error; the other function might return a zero pointer instead of a valid developer Field...