ajmulero / saitoobjloader

Automatically exported from code.google.com/p/saitoobjloader
0 stars 0 forks source link

Crash on loading OBJ with 2 vertex indexes per face. #14

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Load an OBJ which has faces with only two vertex indexes (loose edges 
without faces).
2. Objloader will crash due to index out of bounds - see line 864 of 
OBJModel.java

What is the expected output? What do you see instead?
Expected output: Most likely just ignore any 2-vertex faces. What we see: It 
crashes.

What version of the product are you using? On what operating system?
Latest version, 023b, will happen on all OSes.

Please provide any additional information below.
The OBJ spec requires faces to have a minimum of 3 vertex indexes. However, 
many programs will write OBJs with loose edges specifying only 2 vertex indexes 
per face. Though it's not supported by the spec, it is somewhat common (and 
arguably useful). Objloader doesn't necessarily need to load or display loose 
edges but should at least handle these files without a crash. Line 855 is a 
check to see if at least 3 verts have been specified, but for some reason this 
code is commented out so the error is unhandled. Reinstating this commented 
code should solve the issue.

Original issue reported on code.google.com by jaceprie...@gmail.com on 14 Jun 2013 at 5:14