From 248e3d74a0382dcdf5baf19336ed97e98220fafc Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Sat, 24 Aug 2013 11:42:00 +0000 Subject: Fix for [#36374] Read unitialized memory in Freestyle. A variable keeping a bounding box was referenced after it was flagged as empty. --- source/blender/freestyle/intern/application/Controller.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source/blender/freestyle/intern/application/Controller.cpp') diff --git a/source/blender/freestyle/intern/application/Controller.cpp b/source/blender/freestyle/intern/application/Controller.cpp index dbf3fa8349e..c61f72295d2 100644 --- a/source/blender/freestyle/intern/application/Controller.cpp +++ b/source/blender/freestyle/intern/application/Controller.cpp @@ -290,6 +290,8 @@ int Controller::LoadMesh(Render *re, SceneRenderLayer *srl) _ListOfModels.push_back("Blender_models"); + _Scene3dBBox = _RootNode->bbox(); + _bboxDiag = (_RootNode->bbox().getMax() - _RootNode->bbox().getMin()).norm(); if (G.debug & G_DEBUG_FREESTYLE) { cout << "Triangles nb : " << _SceneNumFaces << endl; @@ -339,6 +341,7 @@ void Controller::DeleteWingedEdge() // clears the grid _Grid.clear(); + _Scene3dBBox.clear(); _SceneNumFaces = 0; _minEdgeSize = DBL_MAX; } @@ -540,8 +543,8 @@ void Controller::ComputeViewMap() } _Chrono.start(); // Build View Map - _ViewMap = vmBuilder.BuildViewMap(*_winged_edge, _VisibilityAlgo, _EPSILON, _RootNode->bbox(), _SceneNumFaces); - _ViewMap->setScene3dBBox(_RootNode->bbox()); + _ViewMap = vmBuilder.BuildViewMap(*_winged_edge, _VisibilityAlgo, _EPSILON, _Scene3dBBox, _SceneNumFaces); + _ViewMap->setScene3dBBox(_Scene3dBBox); if (G.debug & G_DEBUG_FREESTYLE) { printf("ViewMap edge count : %i\n", _ViewMap->viewedges_size()); -- cgit v1.2.3