View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0006840 | ITK | public | 2008-04-17 14:25 | 2010-10-21 12:31 | |||||
Reporter | Ryan Baumann | ||||||||
Assigned To | Bradley Lowekamp | ||||||||
Priority | normal | Severity | crash | Reproducibility | always | ||||
Status | closed | Resolution | fixed | ||||||
Platform | OS | OS Version | |||||||
Product Version | |||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0006840: ImageFileReader::DoConvertBuffer/ConvertPixelBuffer segfaults if numberOfPixels > INT_MAX | ||||||||
Description | Trying to do a file read which requires a buffer conversion with more than INT_MAX elements/pixels causes a segmentation fault (INT_MAX is defined as 2147483647 on most architectures). This is because all the functions in ConvertPixelBuffer take a size argument as a signed integer, so DoConvertBuffer performs a static_cast to int on the unsigned long numberOfPixels. An easy workaround is to remove the static casts and change all ConvertPixelBuffer functions to use an unsigned long for "size". It may, however, be preferable to instead use a type such as size_t. Attached is a patch against 3.4.0, though the bug is still present in 3.6.0. | ||||||||
Additional Information | ImageReadWrite example, modified to PixelType float and Dimension = 3, reading a 2000 x 2000 x 537 NRRD of type short: Debug: In /home/baumann/source/educe/Seg3D/thirdparty.bin/3.1.0/Linux/gcc-4.2.3-64bit/include/InsightToolkit/IO/itkImageFileReader.txx, line 311 ImageFileReader (0x7139f0): StreamableRegion set to =ImageRegion (0x713b00) Dimension: 3 Index: [0, 0, 0] Size: [2000, 2000, 537] Debug: In /home/baumann/source/educe/Seg3D/thirdparty.bin/3.1.0/Linux/gcc-4.2.3-64bit/include/InsightToolkit/Common/itkProcessObject.h, line 271 ImageFileReader (0x7139f0): returning ReleaseDataBeforeUpdateFlag of 0 Debug: In /home/baumann/source/educe/Seg3D/thirdparty.bin/3.1.0/Linux/gcc-4.2.3-64bit/include/InsightToolkit/IO/itkImageFileReader.txx, line 324 ImageFileReader (0x7139f0): ImageFileReader::GenerateData() Allocating the buffer with the StreamableRegion ImageRegion (0x713b00) Dimension: 3 Index: [0, 0, 0] Size: [2000, 2000, 537] Debug: In /home/baumann/source/educe/Seg3D/thirdparty.bin/3.1.0/Linux/gcc-4.2.3-64bit/include/InsightToolkit/IO/itkImageFileReader.txx, line 354 ImageFileReader (0x7139f0): ioRegion: ImageIORegion (0x7fff30d31db0) Dimension: 3 Index: 0 0 0 Size: 2000 2000 537 Debug: In /home/baumann/source/educe/Seg3D/thirdparty.bin/3.1.0/Linux/gcc-4.2.3-64bit/include/InsightToolkit/IO/itkImageFileReader.txx, line 370 ImageFileReader (0x7139f0): Buffer conversion required. Debug: In /home/baumann/source/educe/Seg3D/thirdparty.bin/3.1.0/Linux/gcc-4.2.3-64bit/include/InsightToolkit/IO/itkImageFileReader.txx, line 381 ImageFileReader (0x7139f0): Buffer conversion required from: s to: f Segmentation fault (core dumped) | ||||||||
Tags | No tags attached. | ||||||||
Resolution Date | |||||||||
Sprint | |||||||||
Sprint Status | |||||||||
Attached Files | ![]() | ||||||||
Relationships | |
Relationships |
Notes | |
(0017115) Bradley Lowekamp (developer) 2009-08-13 09:28 |
Committed fix: http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/IO/itkConvertPixelBuffer.h.diff?cvsroot=Insight&r1=1.11&r2=1.12 [^] http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/IO/itkConvertPixelBuffer.txx.diff?cvsroot=Insight&r1=1.25&r2=1.26 [^] http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/IO/itkImageFileReader.h.diff?cvsroot=Insight&r1=1.32&r2=1.33 [^] http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/IO/itkImageFileReader.txx.diff?cvsroot=Insight&r1=1.87&r2=1.88 [^] added test: http://public.kitware.com/cgi-bin/viewcvs.cgi/Testing/Code/IO/itkLargeImageWriteConvertReadTest.cxx?cvsroot=Insight&rev=1.1&view=markup [^] |
(0017116) Bradley Lowekamp (developer) 2009-08-13 09:28 |
The committed code seems to have resolved the problem. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2008-04-17 14:25 | Ryan Baumann | New Issue | |
2008-04-17 14:25 | Ryan Baumann | File Added: itkbug.patch | |
2009-02-03 14:03 | Bradley Lowekamp | Status | new => assigned |
2009-02-03 14:03 | Bradley Lowekamp | Assigned To | => Bradley Lowekamp |
2009-08-13 09:28 | Bradley Lowekamp | Note Added: 0017115 | |
2009-08-13 09:28 | Bradley Lowekamp | Note Added: 0017116 | |
2009-08-13 09:28 | Bradley Lowekamp | Status | assigned => resolved |
2009-08-13 09:28 | Bradley Lowekamp | Resolution | open => fixed |
2010-10-21 12:31 | Gabe Hart | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |