Skip to content

Radient: GLTF Loader handles sparse accessors incorrectly #265

Description

@TheMostDiligent

The current Diligent implementation unconditionally obtains:

Accessor
BufferView
Buffer

and then returns a pointer into the buffer. It does not materialize sparse replacements.

A valid sparse accessor may have no base bufferView; in that case, its base values are defined as zeros and the sparse entries are overlaid on top.

Therefore there are two failure modes:

A sparse accessor with a base buffer view silently ignores all sparse overrides.
A sparse-only accessor has an invalid base buffer-view ID and can enter an invalid lookup path.

This applies to vertex attributes, indices, inverse bind matrices, and animation accessors.

Full-span validation is also missing

Diligent's TinyGLTF buffer wrapper only checks that the starting offset is inside the buffer. It does not verify that the last accessor element fits.

The glTF requirement is effectively:

accessorOffset
+ stride * (count - 1)
+ elementSize
<= bufferViewLength

with corresponding checks against the underlying buffer.

A malformed count or stride can therefore produce an initially valid pointer followed by out-of-bounds reads during bounding-box calculation, hashing, index packing, or vertex packing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions