View Issue Details

IDProjectCategoryView StatusLast Update
0004404Slicer4Core: MRMLpublic2017-08-05 08:33
ReportermoselhyAssigned Tolassoan 
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionno change required 
Product Version 
Target VersionFixed in Version 
Summary0004404: new vtkStringArray get/set methods crash Slicer
Description

Hello,

Slicer crashes when a vtkStringArray is queried for a value that is out of bounds. I feel like this should just throw an error instead of crashing all of Slicer...

Steps To Reproduce

Run the following code in a new instance of Slicer.

import vtk
s = vtk.vtkStringArray()
s.GetValue(0)

or:

import vtk
s = vtk.vtkStringArray()
s.SetValue(0, "test")

TagsNo tags attached.

Activities

lassoan

lassoan

2017-08-03 16:21

developer   ~0015008

Updated documentation to clarify that this is the expected behavior for wrapped C++ objects:
https://www.slicer.org/wiki/Documentation/Nightly/Developers/FAQ/Python_Scripting#Slicer_crashes_if_I_try_to_access_a_non-existing_item_in_an_array

lassoan

lassoan

2017-08-05 08:32

developer   ~0015025

I've also reported this to VTK developer list: http://vtk.1045678.n5.nabble.com/Safer-item-access-in-Python-wrapped-VTK-arrays-td5744288.html

It seems there is a chance that VTK wrappers will be made smarter and safer in the future.

Issue History

Date Modified Username Field Change
2017-07-31 14:34 moselhy New Issue
2017-07-31 14:34 moselhy Status new => assigned
2017-07-31 14:34 moselhy Assigned To => alexy
2017-08-03 16:21 lassoan Assigned To alexy => lassoan
2017-08-03 16:21 lassoan Status assigned => resolved
2017-08-03 16:21 lassoan Resolution open => no change required
2017-08-03 16:21 lassoan Note Added: 0015008
2017-08-05 08:32 lassoan Note Added: 0015025
2017-08-05 08:33 lassoan Status resolved => closed