This reproduces on noble (24.04) with meshlab 2020.09+dfsg1-2build2, on any OBJ
whose faces use its first
vertex, which is nearly every OBJ. A single triangle is enough (triangle.obj,
attached):
$ xvfb-run -a meshlabserver -i triangle.obj -o out.ply
meshlabserver: ./vcglib/wrap/io_trimesh/import_obj.h:640: static int
vcg::tri::io::ImporterOBJ<OpenMeshType>::Open(OpenMeshType&, const char*,
Info&) [with OpenMeshType = CMeshO]: Assertion `(numTriangles +numVertices) ==
numVerticesPlusFaces+extraTriangles' failed.
Aborted
The cause is two lines in MeshLab 2020.09's bundled copy of vcglib, which the
2020.09 vcglib tag doesn't
have. vcglib/wrap/io_trimesh/import_obj.h adds this to GoodObjIndex:
if (index == 0)
return false; // in obj files, indices must start from 1
By the time GoodObjIndex runs, SplitToken has already taken one from every
index, so 0 here is the file's
vertex 1. Every face using the first vertex is dropped without an error. A
build with assertions, which
Debian & Ubuntu's are, since CMAKE_BUILD_TYPE=None sets no NDEBUG, then fails
the count check at line 640 &
aborts. A build without assertions silently loses those faces instead. vcglib
dropped the check after 2020.09.
2020.12, 2022.02, 2023.12 & 2025.07 don't have it.
The attached patch removes those two lines. Removing them alone would bring
back an older fault, which
vcglib fixed on devel in commit c7dfcd9a: GoodObjIndex compares the zero based
index as one based, so an
index one past the last vertex passes, & the triangulating path ignores what
GoodObjIndex returns. So the
patch also holds the index below the vertex count & checks that path, as devel
does. I tested it by
compiling the importer from the 2020.09+dfsg1 orig tarball, with the patch &
with assertions on. One &
two triangle OBJ files, relative indices & a textured quad load with all their
faces, where the unpatched
copy aborts. A face naming a vertex past the last is refused. I haven't rebuilt
the package itself.
Debian unstable has moved to 2025.07, which doesn't have the fault. bookworm &
trixie ship 2020.09+dfsg1-2 &
have it too. I've reported it to Debian as well: [DEBIAN BUG NUMBER, once it
has one].
** Patch added: "meshlab-2020.09-obj-vertex-index.patch"
https://bugs.launchpad.net/ubuntu/+source/meshlab/+bug/1995736/+attachment/6019836/+files/meshlab-2020.09-obj-vertex-index.patch
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1995736
Title:
meshlab crashes during obj import
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/meshlab/+bug/1995736/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs