Crash on import Collada file
Closed, ResolvedPublic

Description

System Information
Linux Mint 18, Intel(R) HD Graphics 5500 (Broadwell GT2)

Blender Version
Broken: 2.78c

Short description of error
Blander crashes on import of specific Collada file

Exact steps for others to reproduce the error

  1. File/Import/Collada
  2. Select the file/Import Collada

Details

Type
Bug
Aaron Carlisle (Blendify) triaged this task as "Confirmed" priority.Apr 5 2017, 6:34 PM
Aaron Carlisle (Blendify) edited projects, added Import/Export; removed BF Blender.

Hi;

I can confirm that blender crashes. The reason for the crash is that the Collada importer does a program abort because of a wrong data structure:

As far as i understand the collada syntax says that mesh geometries are embedded in <source> elements. According to collada 1.4.1 mesh geometries are stored in this scheme:

<library_geometries>
    <geometry id="headMesh-mesh" name="headMesh">
      <mesh>
        <source id="headMesh-mesh-positions">
          <float_array >
             ...
          </float_array>
        </source>
      </mesh>
    </geometry>
</library_geometries>

The breaking file does not contain the <source> element:

<library_geometries>
    <geometry id="target__pCylinderShape1" name="target__pCylinderShape1">
      <mesh>
        <float_array>
          ...
        </float_array>
      </mesh>
    </geometry>
</library_geometries>

The collada importer does not find the data and complains about missing information. Unfortunately it believes this is a major failure and aborts the program. The external opencollada function involved here is:

void MeshLoader::initializePositionsOffset ()
    {
        ...
        const SourceBase* sourceBase = getSourceById ( sourceId );
        COLLADABU_ASSERT ( sourceBase != 0 );
        if ( sourceBase == 0 )
            handleFWLError ( SaxFWLError::ERROR_DATA_NOT_VALID, "Positions sourceBase is null.", IError::SEVERITY_CRITICAL );
        ...
    }

The problem is that COLLADABU_ASSERT does the program abort. So the next line where the error is handled more gracefully is never called in this case. A further investigation shows that actually the assert function should only do something when opencollada is built with debugmode. exist in the debug libraries. So the true question is why is it used in the release.

A more detailed inspection shows that OpenCollada behaves differently in Debug builds and in Release builds:

  • In debug builds it enforces a complete program abort without any chance to step in between and do a graceful cancellation of the import.
  • In Release builds, the application's error handler is called back, but the decision of the handler is not taken into account. And the parser continues. In this particular case we end up with a nullpointer exception further down the line.

I have found a possible fix for this, but this must be done in the OpenCollada library itself. I have created a pull request, see https://github.com/KhronosGroup/OpenCOLLADA/pull/506

Gaia Clary (gaiaclary) closed this task as "Resolved".Jun 25 2017, 2:59 PM

This has been fixed with commit 89060babbcd6099e0d53cf0164661d11a79369bd
Please can you check if it works for you now?

thanks,
Gaia

Fixed. Thank you.