File: 02_fix_potential_null_ptr_dereference_in_adopt_policy.patch

package info (click to toggle)
luabind 0.9.1%2Bgit20150823%2Bdfsg-3.2
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 1,708 kB
  • sloc: cpp: 14,884; makefile: 204; sh: 41; python: 38; ansic: 11
file content (18 lines) | stat: -rw-r--r-- 638 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Author: Andreas Grob <vilarion@illarion.org>
Description: Fixes possible null pointer dereference in luabind::adopt (Closes: #758580)
diff --git a/luabind/adopt_policy.hpp b/luabind/adopt_policy.hpp
index 5e81b94..59558e1 100644
--- a/luabind/adopt_policy.hpp
+++ b/luabind/adopt_policy.hpp
@@ -65,7 +65,11 @@ namespace luabind { namespace detail

             object_rep* obj = static_cast<object_rep*>(
                 lua_touserdata(L, index));
-            obj->release();
+
+            if (obj)
+            {
+                obj->release();
+            }

             adjust_backref_ownership(ptr, boost::is_polymorphic<T>());