Page MenuHome

Segmentation fault due to out-of-range VertexGroup.weight() call
Closed, ResolvedPublic

Description

  1. Create a plane.
  2. Go into edit mode for the plane.
  3. Select one of the vertices.
  4. Create a new vertex group containing only that vertex.
  5. Assuming your plane is named "Plane", in the Blender console, evaluate:
D.objects['Plane'].vertex_groups[0].weight(4)

Segmentation fault. The issue seems to be a lack of bounds checking in the weight() function.

# Blender 2.78 (sub 0), Commit date: 2016-10-24 12:20, Hash e8299c8
bpy.ops.mesh.primitive_plane_add(radius=1, view_align=False, enter_editmode=False, location=(0, 0, 0), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))  # Operator
bpy.ops.object.editmode_toggle()  # Operator
bpy.context.space_data.context = 'DATA'  # Property
bpy.ops.object.vertex_group_add()  # Operator
bpy.ops.object.vertex_group_deselect()  # Operator
bpy.context.area.type = 'CONSOLE'  # Property

# backtrace
blender(BLI_system_backtrace+0x30) [0x13e3dd0]
blender() [0xa19849]
/usr/lib/libc.so.6(+0x330b0) [0x7fd8f98db0b0]
blender(ED_vgroup_vert_weight+0xa4) [0xcac264]
blender(VertexGroup_weight_call+0x1d) [0x12f9afd]
blender(RNA_function_call+0x12) [0x1259842]
blender() [0xe1e003]
/usr/lib/libpython3.5m.so.1.0(PyObject_Call+0x47) [0x7fd9045142d7]
/usr/lib/libpython3.5m.so.1.0(PyEval_EvalFrameEx+0x3d6b) [0x7fd9045ceaeb]
/usr/lib/libpython3.5m.so.1.0(+0x1282c3) [0x7fd9045d42c3]
/usr/lib/libpython3.5m.so.1.0(PyEval_EvalCodeEx+0x23) [0x7fd9045d43a3]
/usr/lib/libpython3.5m.so.1.0(PyEval_EvalCode+0x1b) [0x7fd9045d43cb]
/usr/lib/libpython3.5m.so.1.0(+0x11c63d) [0x7fd9045c863d]
/usr/lib/libpython3.5m.so.1.0(PyCFunction_Call+0xc9) [0x7fd90455b8a9]
/usr/lib/libpython3.5m.so.1.0(PyEval_EvalFrameEx+0x86fb) [0x7fd9045d347b]
/usr/lib/libpython3.5m.so.1.0(PyEval_EvalFrameEx+0x88ca) [0x7fd9045d364a]
/usr/lib/libpython3.5m.so.1.0(+0x1282c3) [0x7fd9045d42c3]
/usr/lib/libpython3.5m.so.1.0(PyEval_EvalFrameEx+0x5d8e) [0x7fd9045d0b0e]
/usr/lib/libpython3.5m.so.1.0(PyEval_EvalFrameEx+0x88ca) [0x7fd9045d364a]
/usr/lib/libpython3.5m.so.1.0(PyEval_EvalFrameEx+0x88ca) [0x7fd9045d364a]
/usr/lib/libpython3.5m.so.1.0(+0x1282c3) [0x7fd9045d42c3]
/usr/lib/libpython3.5m.so.1.0(PyEval_EvalCodeEx+0x23) [0x7fd9045d43a3]
/usr/lib/libpython3.5m.so.1.0(+0x93008) [0x7fd90453f008]
/usr/lib/libpython3.5m.so.1.0(PyObject_Call+0x47) [0x7fd9045142d7]
blender() [0xe1e71e]
blender() [0x1365d36]
blender() [0xa212fa]
blender() [0xa225ed]
blender() [0xa22a6f]
blender() [0xa22f38]
blender(wm_event_do_handlers+0x3c5) [0xa23435]
blender(WM_main+0x18) [0xa1a498]
blender(main+0x40f) [0x9fa63f]
/usr/lib/libc.so.6(__libc_start_main+0xf1) [0x7fd8f98c8291]
blender(_start+0x2a) [0xa1654a]