View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0016054VTK(No Category)public2016-04-01 04:312016-07-06 10:47
ReporterStefano Borini 
Assigned ToDavid Gobbi 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version6.3.0 
Target VersionFixed in Version7.1.0 
Summary0016054: Unmangle pointer attempts to unmangle raw data that happens to match the swig format
Descriptionthe following value

>>> str(np.getbuffer(np.array([-8.3747958651808272])))
'_A_>\xe5\xbf \xc0'

happens to produce a representation that is considered by UnmanglePointer as a SWIG pointer. The consequence of this is that passing in the python wrapper a numpy.getbuffer to SetVoidArray will complain that "required type is p_void"

result_array.SetVoidArray(np.getbuffer(z_flat), len(z_flat), 1)

This problem is mitigated in vtk7 by using memoryview instead, but if you use a python buffer,. the VTK code detects it as such and attempts the unmangling.

More context for the issue can be found here:

https://github.com/enthought/mayavi/issues/119 [^]
TagsNo tags attached.
ProjectTBD
Typecrash
Attached Files

 Relationships

  Notes
(0035917)
David Gobbi (developer)
2016-04-28 17:06

The swig pointer functionality should simply be removed from SetVoidArray(). I doubt that anyone uses it, and AFAIK it isn't even documented. So that's what we can do for VTK 7.1.

For VTK 6.3.x, the check can be changed so that if the value doesn't exactly match "_hex_p_void", it will be used as a buffer (i.e. if it fails the "type check", it will be used as a buffer).

Note that a possible work-around is to go in the opposite direction, i.e. from VTK to numpy, by using the buffer interface of vtkDataArray and its subclasses.
(0035918)
David Gobbi (developer)
2016-04-28 18:21

Merge request:

https://gitlab.kitware.com/vtk/vtk/merge_requests/1469 [^]
(0036080)
David Gobbi (developer)
2016-06-17 11:24

The fix has been merged into VTK master branch for 7.1. It still needs to be backported to the 6.3 maintenance branch.

 Issue History
Date Modified Username Field Change
2016-04-01 04:31 Stefano Borini New Issue
2016-04-28 16:13 David Gobbi Assigned To => David Gobbi
2016-04-28 17:06 David Gobbi Note Added: 0035917
2016-04-28 18:21 David Gobbi Note Added: 0035918
2016-04-28 18:21 David Gobbi Status backlog => gerrit review
2016-06-17 11:24 David Gobbi Note Added: 0036080
2016-07-06 10:47 David Gobbi Status gerrit review => closed
2016-07-06 10:47 David Gobbi Resolution open => fixed
2016-07-06 10:47 David Gobbi Fixed in Version => 7.1.0


Copyright © 2000 - 2018 MantisBT Team