Coverity 2026/4/4

AnyOldName3
2026-04-04T15:08:00Z

Hi,

Please find the latest report on new defect(s) introduced to **OpenMW/openmw** found with Coverity Scan.

* **New Defects Found:** 2
* **Defects Shown:** Showing 2 of 2 defect(s)
## Defect Details
```
** CID 645388: Incorrect expression (DIVIDE_BY_ZERO)
/apps/openmw/mwrender/renderingmanager.cpp: 1138 in MWRender::RenderingManager::updateProjectionMatrix()()

_____________________________________________________________________________________________
*** CID 645388: Incorrect expression (DIVIDE_BY_ZERO)
/apps/openmw/mwrender/renderingmanager.cpp: 1138 in MWRender::RenderingManager::updateProjectionMatrix()()
1132
1133 osg::Matrix projectionMatrix = SceneUtil::AutoDepth::isReversed()
1134 ? SceneUtil::getReversedZProjectionMatrixAsPerspective(fov, aspect, mNearClip, mViewDistance)
1135 : unreversedProjectionMatrix;
1136
1137 double offsetX = (mProjectionOffset.x() / width) * 2.0;
>>> CID 645388: Incorrect expression (DIVIDE_BY_ZERO)
>>> In expression "this->mProjectionOffset.y() / height", division by expression "height" which may be zero has undefined behavior.
1138 double offsetY = (mProjectionOffset.y() / height) * 2.0;
1139
1140 const osg::Matrix translation = osg::Matrix::translate(offsetX, offsetY, 0.0);
1141
1142 projectionMatrix.postMult(translation);
1143 unreversedProjectionMatrix.postMult(translation);

** CID 645387: Uninitialized variables (UNINIT)
/apps/openmw/mwlua/types/usertypeutil.hpp: 175 in MWLua::Types::initFromTemplate(const sol::basic_table_core<(bool)0, sol::basic_reference<(bool)0>> &)()

_____________________________________________________________________________________________
*** CID 645387: Uninitialized variables (UNINIT)
/apps/openmw/mwlua/types/usertypeutil.hpp: 175 in MWLua::Types::initFromTemplate(const sol::basic_table_core<(bool)0, sol::basic_reference<(bool)0>> &)()
169 return rec["template"].get>().find();
170 else
171 return LuaUtil::cast(rec["template"]);
172 }
173 Record out;
174 out.blank();
>>> CID 645387: Uninitialized variables (UNINIT)
>>> Using uninitialized value "out". Field "out.mData.mUnknown1" is uninitialized.
175 return out;
176 }
177 }
178
```