Skip to content

Crash in Ogre::AxisAlignedBox triggered by invalid camera clip planes (extreme near) #584

@XINJIANGMO

Description

@XINJIANGMO

Environment

  • OS Version: Ubuntu noble
  • Source or binary build?
    Source , gz-sensors10

Description

  • Expected behavior: not crash but warning or error msg
  • Actual behavior: crash
    build option : Coverage

Steps to reproduce

  1. gz sim -r crash.sdf
  2. crash

caused by

<clip>
     <near>1e308</near>
      <far>10.0</far>
</clip>

Output

gz-sim-main: ./OgreMain/include/OgreAxisAlignedBox.h:250: void Ogre::AxisAlignedBox::setExtents(const Ogre::Vector3&, const Ogre::Vector3&): Assertion `(min.x <= max.x && min.y <= max.y && min.z <= max.z) && "The minimum corner of the box must be less than or equal to maximum corner"' failed.
Stack trace (most recent call last) in thread 1142219:
#31   Object "", at 0xffffffffffffffff, in 
#30   Source "../sysdeps/unix/sysv/linux/x86_64/clone3.S", line 78, in clone3 [0x738ab8129c6b]
#29   Source "./nptl/pthread_create.c", line 447, in start_thread [0x738ab809caa3]
#28   Source "../../../../../src/libstdc++-v3/src/c++11/thread.cc", line 104, in execute_native_thread_routine [0x738ab84ecdb3]
#27   Source "/usr/include/c++/13/bits/std_thread.h", line 244, in _M_run [0x738aa43f7caf]
        241: 	  { }
        242: 
        243: 	void
      > 244: 	_M_run() { _M_func(); }
        245:       };
        246: 
        247:     void
#26   Source "/usr/include/c++/13/bits/std_thread.h", line 299, in operator() [0x738aa43fcd6d]
        296: 	{
        297: 	  using _Indices
        298: 	    = typename _Build_index_tuple<tuple_size<_Tuple>::value>::__type;
      > 299: 	  return _M_invoke(_Indices());
        300: 	}
        301:       };
#25   Source "/usr/include/c++/13/bits/std_thread.h", line 292, in _M_invoke<0, 1> [0x738aa4401d8a]
        289: 	template<size_t... _Ind>
        290: 	  typename __result<_Tuple>::type
        291: 	  _M_invoke(_Index_tuple<_Ind...>)
      > 292: 	  { return std::__invoke(std::get<_Ind>(std::move(_M_t))...); }
        293: 
        294: 	typename __result<_Tuple>::type
        295: 	operator()()
#24   Source "/usr/include/c++/13/bits/invoke.h", line 96, in __invoke<void (gz::sim::v10::systems::SensorsPrivate::*)(), gz::sim::v10::systems::SensorsPrivate*> [0x738aa44062be]
         93:       using __result = __invoke_result<_Callable, _Args...>;
         94:       using __type = typename __result::type;
         95:       using __tag = typename __result::__invoke_type;
      >  96:       return std::__invoke_impl<__type>(__tag{}, std::forward<_Callable>(__fn),
         97: 					std::forward<_Args>(__args)...);
         98:     }
#23   Source "/usr/include/c++/13/bits/invoke.h", line 74, in __invoke_impl<void, void (gz::sim::v10::systems::SensorsPrivate::*)(), gz::sim::v10::systems::SensorsPrivate*> [0x738aa440a047]
         71:     __invoke_impl(__invoke_memfun_deref, _MemFun&& __f, _Tp&& __t,
         72: 		  _Args&&... __args)
         73:     {
      >  74:       return ((*std::forward<_Tp>(__t)).*__f)(std::forward<_Args>(__args)...);
         75:     }
         76: 
         77:   template<typename _Res, typename _MemPtr, typename _Tp>
#22   Source "/home/momo/gz_jetty/src/gz-sim/src/systems/sensors/Sensors.cc", line 539, in RenderThread [0x738aa43363c9]
        537:   while (this->running)
        538:   {
      > 539:     this->RunOnce();
        540:   }
        541: 
        542:   this->eventManager->Emit<events::RenderTeardown>();
#21   Source "/home/momo/gz_jetty/src/gz-sim/src/systems/sensors/Sensors.cc", line 418, in RunOnce [0x738aa433518a]
        415:   {
        416:     GZ_PROFILE("Update");
        417:     std::unique_lock<std::mutex> timeLock(this->renderUtilMutex);
      > 418:     this->renderUtil.Update();
        419:     this->updateTimeApplied = this->updateTime;
        420:     this->updateTimeCv.notify_one();
        421:   }
#20   Source "/home/momo/gz_jetty/src/gz-sim/src/rendering/RenderUtil.cc", line 1323, in Update [0x738a9ef42cb9]
       1320:         }
       1321: 
       1322:         std::string sensorName =
      >1323:             this->dataPtr->createSensorCb(entity, dataSdf, parentNode->Name());
       1324:         // Add to the system's scene manager
       1325:         if (!this->dataPtr->sceneManager.AddSensor(entity, sensorName, parent))
       1326:         {
#19   Source "/usr/include/c++/13/bits/std_function.h", line 591, in operator() [0x738a9efe1eb8]
        588:       {
        589: 	if (_M_empty())
        590: 	  __throw_bad_function_call();
      > 591: 	return _M_invoker(_M_functor, std::forward<_ArgTypes>(__args)...);
        592:       }
        593: 
        594: #if __cpp_rtti
#18   Source "/usr/include/c++/13/bits/std_function.h", line 291, in _M_invoke [0x738aa437137c]
        288:       _M_invoke(const _Any_data& __functor, _ArgTypes&&... __args)
        289:       {
        290: 	return std::__invoke_r<_Res>(*_Base::_M_get_pointer(__functor),
      > 291: 				     std::forward<_ArgTypes>(__args)...);
        292:       }
        293: 
        294:       template<typename _Fn>
#17   Source "/usr/include/c++/13/bits/invoke.h", line 116, in __invoke_r<std::__cxx11::basic_string<char>, std::_Bind<std::__cxx11::basic_string<char> (gz::sim::v10::systems::Sensors::*(gz::sim::v10::systems::Sensors*, std::_Placeholder<1>, std::_Placeholder<2>, std::_Placeholder<3>))(long unsigned int const&, const sdf::v16::Sensor&, const std::__cxx11::basic_string<char>&)>&, long unsigned int const&, const sdf::v16::Sensor&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&> [0x738aa438e877]
        113:       else
        114: 	return std::__invoke_impl<__type>(__tag{},
        115: 					  std::forward<_Callable>(__fn),
      > 116: 					  std::forward<_Args>(__args)...);
        117:     }
        118: #else // C++11 or C++14
        119:   // This is a non-SFINAE-friendly std::invoke_r<R>(fn, args...) for C++11/14.
#16   Source "/usr/include/c++/13/bits/invoke.h", line 61, in __invoke_impl<std::__cxx11::basic_string<char>, std::_Bind<std::__cxx11::basic_string<char> (gz::sim::v10::systems::Sensors::*(gz::sim::v10::systems::Sensors*, std::_Placeholder<1>, std::_Placeholder<2>, std::_Placeholder<3>))(long unsigned int const&, const sdf::v16::Sensor&, const std::__cxx11::basic_string<char>&)>&, long unsigned int const&, const sdf::v16::Sensor&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&> [0x738aa43a5a95]
         58:   template<typename _Res, typename _Fn, typename... _Args>
         59:     constexpr _Res
         60:     __invoke_impl(__invoke_other, _Fn&& __f, _Args&&... __args)
      >  61:     { return std::forward<_Fn>(__f)(std::forward<_Args>(__args)...); }
         62: 
         63:   template<typename _Res, typename _MemFun, typename _Tp, typename... _Args>
         64:     constexpr _Res
#15   Source "/usr/include/c++/13/functional", line 593, in operator()<long unsigned int const&, const sdf::v16::Sensor&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&> [0x738aa43bbad1]
        590: 	{
        591: 	  return this->__call<_Result>(
        592: 	      std::forward_as_tuple(std::forward<_Args>(__args)...),
      > 593: 	      _Bound_indexes());
        594: 	}
        595: 
        596:       // Call as const
#14   Source "/usr/include/c++/13/functional", line 508, in __call<std::__cxx11::basic_string<char>, long unsigned int const&, const sdf::v16::Sensor&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, 0, 1, 2, 3> [0x738aa43ce67a]
        505: 	{
        506: 	  return std::__invoke(_M_f,
        507: 	      _Mu<_Bound_args>()(std::get<_Indexes>(_M_bound_args), __args)...
      > 508: 	      );
        509: 	}
        510: 
        511:       // Call as const
#13   Source "/usr/include/c++/13/bits/invoke.h", line 97, in __invoke<std::__cxx11::basic_string<char> (gz::sim::v10::systems::Sensors::*&)(long unsigned int const&, const sdf::v16::Sensor&, const std::__cxx11::basic_string<char>&), gz::sim::v10::systems::Sensors*&, long unsigned int const&, const sdf::v16::Sensor&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&> [0x738aa43dbc35]
         94:       using __type = typename __result::type;
         95:       using __tag = typename __result::__invoke_type;
         96:       return std::__invoke_impl<__type>(__tag{}, std::forward<_Callable>(__fn),
      >  97: 					std::forward<_Args>(__args)...);
         98:     }
         99: 
        100: #if __cplusplus >= 201703L
#12   Source "/usr/include/c++/13/bits/invoke.h", line 74, in __invoke_impl<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> (gz::sim::v10::systems::Sensors::*&)(long unsigned int const&, const sdf::v16::Sensor&, const std::__cxx11::basic_string<char>&), gz::sim::v10::systems::Sensors*&, long unsigned int const&, const sdf::v16::Sensor&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&> [0x738aa43e6178]
         71:     __invoke_impl(__invoke_memfun_deref, _MemFun&& __f, _Tp&& __t,
         72: 		  _Args&&... __args)
         73:     {
      >  74:       return ((*std::forward<_Tp>(__t)).*__f)(std::forward<_Args>(__args)...);
         75:     }
         76: 
         77:   template<typename _Res, typename _MemPtr, typename _Tp>
#11   Source "/home/momo/gz_jetty/src/gz-sim/src/systems/sensors/Sensors.cc", line 1185, in CreateSensor [0x738aa433fbaa]
       1183:   // Set the scene so it can create the rendering sensor
       1184:   auto renderingSensor = dynamic_cast<sensors::RenderingSensor *>(sensor);
      >1185:   renderingSensor->SetScene(this->dataPtr->scene);
       1186:   renderingSensor->SetParent(_parentName);
       1187:   renderingSensor->SetManualSceneUpdate(true);
#10   Source "/home/momo/gz_jetty/src/gz-sensors/src/DepthCameraSensor.cc", line 531, in SetScene [0x738aad6a8ee5]
        528:     RenderingSensor::SetScene(_scene);
        529: 
        530:     if (this->dataPtr->initialized)
      > 531:       this->CreateCamera();
        532:   }
        533: }
#9    Source "/home/momo/gz_jetty/src/gz-sensors/src/DepthCameraSensor.cc", line 423, in CreateCamera [0x738aad6a7365]
        421:   this->Scene()->RootVisual()->AddChild(this->dataPtr->depthCamera);
        422: 
      > 423:   this->UpdateLensIntrinsicsAndProjection(this->dataPtr->depthCamera,
        424:       *cameraSdf);
        425: 
        426:   // Create the directory to store frames
#8    Source "/home/momo/gz_jetty/src/gz-sensors/src/CameraSensor.cc", line 770, in UpdateLensIntrinsicsAndProjection [0x738aac323d65]
        767:   {
        768:     auto intrinsicMatrix =
        769:       gz::rendering::projectionToCameraIntrinsic(
      > 770:         _camera->ProjectionMatrix(),
        771:         _camera->ImageWidth(),
        772:         _camera->ImageHeight()
        773:       );
#7    Source "/home/momo/gz_jetty/src/gz-rendering/ogre2/src/Ogre2DepthCamera.cc", line 1018, in ProjectionMatrix [0x738a8d23947d]
       1015: /////////////////////////////////////////////////
       1016: math::Matrix4d Ogre2DepthCamera::ProjectionMatrix() const
       1017: {
      >1018:   return Ogre2Conversions::Convert(this->ogreCamera->getProjectionMatrix());
       1019: }
       1020: 
       1021: /////////////////////////////////////////////////
#6    Object "/usr/lib/x86_64-linux-gnu/OGRE-2.3/libOgreNextMain.so.2.3.1", at 0x738a8c5bb208, in Ogre::Frustum::getProjectionMatrix() const
#5    Object "/usr/lib/x86_64-linux-gnu/OGRE-2.3/libOgreNextMain.so.2.3.1", at 0x738a8c5c50dc, in Ogre::Frustum::updateFrustumImpl() const
#4    Source "./assert/assert.c", line 105, in __assert_fail [0x738ab803b516]
#3    Source "./assert/assert.c", line 96, in __assert_fail_base [0x738ab802881a]
#2    Source "./stdlib/abort.c", line 79, in abort [0x738ab80288fe]
#1    Source "../sysdeps/posix/raise.c", line 26, in raise [0x738ab804527d]
#0  | Source "./nptl/pthread_kill.c", line 89, in __pthread_kill_internal
    | Source "./nptl/pthread_kill.c", line 78, in __pthread_kill_implementation
      Source "./nptl/pthread_kill.c", line 44, in __pthread_kill [0x738ab809eb2c]
Aborted (Signal sent by tkill() 1142168 1000)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Inbox

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions