From ef1bc03fce51e2d79551ae87f2f8c7af8f0c6295 Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Tue, 12 Nov 2013 02:28:26 +0000 Subject: Fix #37092 and #37381: crashes in the .object() method of Freestyle iterators. Now the method checks if the iterator is at the end, and returns None if that is the case. --- .../blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp | 2 ++ .../blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp | 2 ++ .../blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp | 2 ++ .../freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp | 2 ++ .../blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp | 2 ++ .../freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp | 2 ++ 6 files changed, 12 insertions(+) (limited to 'source/blender/freestyle') diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp index 510875ebb2f..0daaa1a0476 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp @@ -115,6 +115,8 @@ PyDoc_STRVAR(AdjacencyIterator_object_doc, static PyObject *AdjacencyIterator_object_get(BPy_AdjacencyIterator *self, void *UNUSED(closure)) { + if (self->a_it->isEnd()) + Py_RETURN_NONE; ViewEdge *ve = self->a_it->operator*(); if (ve) return BPy_ViewEdge_from_ViewEdge(*ve); diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp index 3e2f0102dc3..91e8de118a9 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp @@ -175,6 +175,8 @@ PyDoc_STRVAR(ChainingIterator_object_doc, static PyObject *ChainingIterator_object_get(BPy_ChainingIterator *self, void *UNUSED(closure)) { + if (self->c_it->isEnd()) + Py_RETURN_NONE; ViewEdge *ve = self->c_it->operator*(); if (ve) return BPy_ViewEdge_from_ViewEdge(*ve); diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp index 3e45ef17c1b..1655b766a6b 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp @@ -97,6 +97,8 @@ PyDoc_STRVAR(CurvePointIterator_object_doc, static PyObject *CurvePointIterator_object_get(BPy_CurvePointIterator *self, void *UNUSED(closure)) { + if (self->cp_it->isEnd()) + Py_RETURN_NONE; return BPy_CurvePoint_from_CurvePoint(self->cp_it->operator*()); } diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp index 3a537eb672a..2f6c8ff7348 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp @@ -123,6 +123,8 @@ PyDoc_STRVAR(Interface0DIterator_object_doc, static PyObject *Interface0DIterator_object_get(BPy_Interface0DIterator *self, void *UNUSED(closure)) { + if (self->if0D_it->isEnd()) + Py_RETURN_NONE; return Any_BPy_Interface0D_from_Interface0D(self->if0D_it->operator*()); } diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp index f30621f01e3..c191a94f08d 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp @@ -122,6 +122,8 @@ PyDoc_STRVAR(ViewEdgeIterator_object_doc, static PyObject *ViewEdgeIterator_object_get(BPy_ViewEdgeIterator *self, void *UNUSED(closure)) { + if (!self->ve_it->isEnd()) + Py_RETURN_NONE; ViewEdge *ve = self->ve_it->operator*(); if (ve) return BPy_ViewEdge_from_ViewEdge(*ve); diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp index f2b0e604c22..cbefcd3292e 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp @@ -103,6 +103,8 @@ PyDoc_STRVAR(orientedViewEdgeIterator_object_doc, static PyObject *orientedViewEdgeIterator_object_get(BPy_orientedViewEdgeIterator *self, void *UNUSED(closure)) { + if (self->ove_it->isEnd()) + Py_RETURN_NONE; return BPy_directedViewEdge_from_directedViewEdge(self->ove_it->operator*()); } -- cgit v1.2.3