MantisBT - VTK | |||||
| View Issue Details | |||||
| ID | Project | Category | View Status | Date Submitted | Last Update |
| 0011613 | VTK | (No Category) | public | 2010-12-16 09:29 | 2012-12-12 12:19 |
| Reporter | John Stark. | ||||
| Assigned To | David Gobbi | ||||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Platform | OS | OS Version | |||
| Product Version | |||||
| Target Version | Fixed in Version | 5.10.0 | |||
| Project | |||||
| Type | |||||
| Summary | 0011613: vtkOpenGLImageActor hangs if image is empty. | ||||
| Description | When an empty image is passed to the vtkOpenGLImageActor, the MakeDataSuitable method can enter an infinite loop, and hang. The problem only occurs when the image returns it's extents as [0, -1, 0, -1, 0, -1]. In this case, the xsize is inferred to be -1, and the loop to find the next power of 2 falls into an infinite loop. | ||||
| Steps To Reproduce | |||||
| Additional Information | The problem occurs here : xsize = ext[xdim*2+1] - ext[xdim*2] + 1; // xsize and ysize must be a power of 2 in OpenGL xs = static_cast<unsigned short>(xsize); while (!(xs & 0x01)) { xs = xs >> 1; } If xs is zero, the loop never terminates. Please can you add an additional test that both xsize and ysize are > zero : diff --git a/Rendering/vtkOpenGLImageActor.cxx b/Rendering/vtkOpenGLImageActor.cxx index 172b82a..79ee1a8 100644 --- a/Rendering/vtkOpenGLImageActor.cxx +++ b/Rendering/vtkOpenGLImageActor.cxx @@ -154,9 +154,12 @@ unsigned char *vtkOpenGLImageActor::MakeDataSuitable(int &xsize, int &ysize, xsize = ext[xdim*2+1] - ext[xdim*2] + 1; // xsize and ysize must be a power of 2 in OpenGL xs = static_cast<unsigned short>(xsize); - while (!(xs & 0x01)) + if (xsize > 0) { - xs = xs >> 1; + while (!(xs & 0x01)) + { + xs = xs >> 1; + } } if (xs == 1) { @@ -170,9 +173,12 @@ unsigned char *vtkOpenGLImageActor::MakeDataSuitable(int &xsize, int &ysize, ysize = (this->ComputedDisplayExtent[ydim*2+1] - this->ComputedDisplayExtent[ydim*2] + 1); ys = static_cast<unsigned short>(ysize); - while (!(ys & 0x01)) + if (ysize > 0) { - ys = ys >> 1; + while (!(ys & 0x01)) + { + ys = ys >> 1; + } } // yes it is a power of two already if (ys == 1) | ||||
| Tags | No tags attached. | ||||
| Relationships | |||||
| Attached Files | |||||
| Issue History | |||||
| Date Modified | Username | Field | Change | ||
| 2010-12-16 09:29 | John Stark. | New Issue | |||
| 2010-12-16 09:55 | David Gobbi | Assigned To | => David Gobbi | ||
| 2010-12-16 09:55 | David Gobbi | Status | backlog => tabled | ||
| 2010-12-16 10:23 | David Gobbi | Note Added: 0024208 | |||
| 2010-12-16 10:37 | David Gobbi | Status | tabled => @80@ | ||
| 2010-12-16 10:37 | David Gobbi | Resolution | open => fixed | ||
| 2012-12-12 12:19 | David Gobbi | Status | customer review => closed | ||
| 2012-12-12 12:19 | David Gobbi | Fixed in Version | => 5.10.0 | ||
| Notes | |||||
|
|
|||||
|
|
||||