Skip to content

Problem with par_shapes_merge when one mesh has normals and the other doesn't #60

@turol

Description

@turol

This code

par_shapes_merge(a, b);

creates a disk and a dodecahedron and then calls par_shapes_merge on them. The problem is that the disk has normals but the dodecahedron does not.
if (src->normals || dst->normals) {

allocates enough space for normals of both but since the second has none it leaves part of the buffer uninitialized. Later when the code tries to read normals it gets uninitialized values.
You should either

  1. fail the operation when one mesh has normals and the other doesn't
  2. build the missing normals automatically
  3. clear the buffer to zero if normals are missing

Not sure which is best.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions