cyberbotics / webots

Webots Robot Simulator
https://cyberbotics.com
Apache License 2.0
3.11k stars 1.65k forks source link

Crash loading normals without normalIndex from WBT file #354

Closed stefaniapedrazzi closed 5 years ago

stefaniapedrazzi commented 5 years ago

Describe the Bug Webots crashing when loading a world containing a simple IFS for which the normals are defined but the normal indices are not defined (coordIndex used instead)

Steps to Reproduce

  1. Create a new world based on this VRML example https://www.asc.ohio-state.edu/lewis.239/VRML/Class/normals.html
  2. Load the created world.

Stack:

stefi@libeccio:~/webots$ ./webots --stream
Warning: you should also use --batch (in addition to --stream) for production.
webots-bin: vrml/WbMFInt.hpp:58: const int& WbMFInt::item(int) const: Assertion `index >= 0 && index < size()' failed.
Received signal 6
#0 0x7f3d822befdf <unknown>
#1 0x7f3d80ced949 <unknown>
#2 0x7f3d822bf4ee <unknown>
#3 0x7f3d8a0b1f20 <unknown>
#4 0x7f3d8a0b1e97 gsignal
#5 0x7f3d8a0b3801 abort
#6 0x7f3d8a0a339a <unknown>
#7 0x7f3d8a0a3412 __assert_fail
#8 0x55ed184f67ce WbMFInt::item()
#9 0x55ed18779ad6 WbTriangleMesh::indicesPass()
#10 0x55ed18778680 WbTriangleMesh::init()
#11 0x55ed1852ed9c WbIndexedFaceSet::updateTriangleMesh()
#12 0x55ed1852ebca WbIndexedFaceSet::createTriangleMesh()
#13 0x55ed1877f5cd WbTriangleMeshCache::useTriangleMesh()
#14 0x55ed1852e446 WbIndexedFaceSet::preFinalize()
#15 0x55ed1862b96e WbShape::preFinalize()
#16 0x55ed1850da5a WbGroup::preFinalize()
#17 0x55ed186b7f36 WbTransform::preFinalize()
#18 0x55ed1850da5a WbGroup::preFinalize()
#19 0x55ed1845c309 WbBaseNode::finalize()
#20 0x55ed1863bf07 WbSimulationWorld::WbSimulationWorld()
#21 0x55ed18495988 WbControlledWorld::WbControlledWorld()
#22 0x55ed18454b0e WbApplication::loadWorld()
#23 0x55ed1855fa31 WbMainWindow::loadWorld()
#24 0x55ed185146c6 WbGuiApplication::loadInitialWorld()

Expected behavior It would be better if Webots could handle all the valid normal definitions. Otherwise it should at least print an error without crashing.

DavidMansolino commented 5 years ago

Fixed in #445