Notes |
|
(0014547)
|
Bradley Lowekamp
|
2009-01-13 12:00
(edited on: 2009-01-14 17:26) |
|
Searching for problematic code, (ie incorrect usage of size_t) I made the following changes which may fix this bug:
Index: metaImage.cxx
===================================================================
RCS file: /cvsroot/Insight/Insight/Utilities/MetaIO/metaImage.cxx,v
retrieving revision 1.107
diff -r1.107 metaImage.cxx
1901c1901
< size_t endfile = tmpWriteStream->tellp();
---
> unsigned long endfile = tmpWriteStream->tellp();
1904c1904
< size_t padding = seekpos-endfile;
---
> unsigned long padding = seekpos-endfile;
2129c2129
< size_t padding = seekpos-currentPos;
---
> unsigned long padding = seekpos-currentPos;
*not the fix, but wrong types are still used*
|
|
|
(0014554)
|
Bradley Lowekamp
|
2009-01-14 14:41
|
|
I have been able to reproduce this on apple and linux systems |
|
|
(0014555)
|
Bradley Lowekamp
|
2009-01-14 17:24
(edited on: 2009-01-14 17:29) |
|
I have been able to track the problem down to the following on 32-bit systems:
sizeof(std::streamsize):4
sizeof(std::pos_type):16
sizeof(unsigned long):4
metaImage utilizes unsigned long for seeking and teling around files. This is now clearly the wrong type and the corrected type should be related to pos_type. Also calculations which are assigned to this type need to be casts to avoid overflow.
A quick local correction verified that this was the problem and this is the fix.
|
|
|
(0014571)
|
Mathieu Malaterre
|
2009-01-15 04:50
|
|
|