Problem with metis mesh2dual and mesh2nodal

Dear forum,

I'm using the Metis software and lately I encountered a problem with one of my meshes. The result was that my application crashed. I've been able to reproduce the problem in a small mesh (g.mesh), this mess has the strange feature that edge 2-3 is used by 3 triangles. I know the mesh is not correct but I would have expected the software to give an error message / code and not to crash.
(I've looked mainly to mesh2dual, the problem with mesh2nodal looks to be even bigger, resulting in a file with 3161277 lines).

I've not been able to find a function to check the mesh on validity. I think it is easy to derive one from the function in mesh.c by not placing values in dadjncy and at the end checking the values in dxadj. Another option might be to add an argument to METIS_MeshToDual signaling the validity of the mesh. This validity can be tested around the for statement below "/* Go and consolidate the dxadj and dadjncy */". Maybe its is necessary to also protect the lines with dadjncy just above it.

Are there already functions in Metis that can check the validity or should I implement my own or will there be something in the next version. In the later case please advise me which type of check is the better one (extra function or the extra argument one).

Regards,

Albert

== file g.mesh ===========
7 7
6 3
3 4
1 2 6 5
5 5
3 4
1 3
== end g.mesh ============

== file g.mesh.dgraph ==
7 1
1 2 3
2 4 6
2 6 3
4 5 6
5 6 3
2 3 7
== end g.mesh.dgraph ==