KhronosGroup / KhronosGroup/OpenCOLLADA

Unique ID generation bug with invalid files using duplicated ids

Open
#446 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

contribution requested
Dominant language
C++
Stars
678
Forks
260
PR merge metrics
No merged PRs in 30d

Description

As I understand it, the unique ID is supposed to be unique for each object in the scene. However, here is how it's implemented in the code:

const COLLADAFW::UniqueId& Loader::getUniqueId( const COLLADABU::URI& uri, COLLADAFW::ClassId classId ) { URIUniqueIdMap::iterator it = mURIUniqueIdMap.find(uri); if ( it == mURIUniqueIdMap.end() ) { return mURIUniqueIdMap[uri] = COLLADAFW::UniqueId(classId, mLoaderUtil.getLowestObjectIdFor(classId), getFileId(uri)); } else { return it->second; } }

I.e. it's mapped just by url, ignoring the class type. So if the file has a mesh and a node named in the same way for example, they will both end up with the same unique id. Also the second object will report wrong class. Example file can be found in three.js:
http://threejs.org/examples/#webgl_loader_collada_keyframe

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating Loader::getUniqueId and inspect how mURIUniqueIdMap is keyed and how UniqueId stores its class information. Reproduce the issue with the three.js webgl_loader_collada_keyframe example, then verify that objects sharing a URI receive distinct IDs with the correct class type.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.