#225 always overflow destination buffer

2.0.19
closed
5
2011-11-30
2011-11-30
No

Get error

[ 83%] Building CXX object Source/MediaStorageAndFileFormat/CMakeFiles/gdcmMSFF.dir/gdcmPrinter.cxx.o
cd /usr/src/RPM/BUILD/gdcm-2.0.18/BUILD/Source/MediaStorageAndFileFormat && /usr/bin/c++ -DgdcmMSFF_EXPORTS -pipe -Wall -g -O2 -march=i586 -mtune=i686 -O3 -DNDEBUG -fPIC -I/usr/src/RPM/BUILD/gdcm-2.0.18/Source/Common -I/usr/src/RPM/BUILD/gdcm-2.0.18/BUILD/Source/Common -I/usr/src/RPM/BUILD/gdcm-2.0.18/Source/DataStructureAndEncodingDefinition -I/usr/src/RPM/BUILD/gdcm-2.0.18/Source/DataDictionary -I/usr/src/RPM/BUILD/gdcm-2.0.18/Source/InformationObjectDefinition -I/usr/src/RPM/BUILD/gdcm-2.0.18/Source/MediaStorageAndFileFormat -I/usr/src/RPM/BUILD/gdcm-2.0.18/Utilities -I/usr/src/RPM/BUILD/gdcm-2.0.18/BUILD/Utilities -o CMakeFiles/gdcmMSFF.dir/gdcmPrinter.cxx.o -c /usr/src/RPM/BUILD/gdcm-2.0.18/Source/MediaStorageAndFileFormat/gdcmPrinter.cxx
In file included from /usr/include/string.h:658:0,
from /usr/lib/gcc/i586-alt-linux/4.5.1/../../../../include/c++/4.5.1/cstring:45,
from /usr/src/RPM/BUILD/gdcm-2.0.18/Source/DataStructureAndEncodingDefinition/gdcmElement.h:30,
from /usr/src/RPM/BUILD/gdcm-2.0.18/Source/DataStructureAndEncodingDefinition/gdcmDataSet.h:20,
from /usr/src/RPM/BUILD/gdcm-2.0.18/Source/DataStructureAndEncodingDefinition/gdcmFile.h:18,
from /usr/src/RPM/BUILD/gdcm-2.0.18/Source/MediaStorageAndFileFormat/gdcmPrinter.h:46,
from /usr/src/RPM/BUILD/gdcm-2.0.18/Source/MediaStorageAndFileFormat/gdcmPrinter.cxx:14:
In function 'void* memcpy(void*, const void*, size_t)',
inlined from 'void gdcm::PrintValue(const gdcm::VR::VRType&, const gdcm::VM&, const gdcm::Value&)' at /usr/src/RPM/BUILD/gdcm-2.0.18/Source/MediaStorageAndFileFormat/gdcmPrinter.cxx:418:5:
/usr/include/bits/string3.h:52:71: error: call to void* __builtin___memcpy_chk(void*, const void*, unsigned int, unsigned int) will always overflow destination buffer
make[2]: *** [Source/MediaStorageAndFileFormat/CMakeFiles/gdcmMSFF.dir/gdcmPrinter.cxx.o] Error 1
make[2]: Leaving directory `/usr/src/RPM/BUILD/gdcm-2.0.18/BUILD'
make[1]: *** [Source/MediaStorageAndFileFormat/CMakeFiles/gdcmMSFF.dir/all] Error 2
make[1]: Leaving directory `/usr/src/RPM/BUILD/gdcm-2.0.18/BUILD'
make: *** [all] Error 2
make: Leaving directory `/usr/src/RPM/BUILD/gdcm-2.0.18/BUILD'
error: Bad exit status from /usr/src/tmp/rpm-tmp.61218 (%build)

For fix use patch:

diff --git a/Source/DataStructureAndEncodingDefinition/gdcmElement.h b/Source/DataStructureAndEncodingDefinition/gdcmElement.h
index 54e3796..9e8f176 100644
--- a/Source/DataStructureAndEncodingDefinition/gdcmElement.h
+++ b/Source/DataStructureAndEncodingDefinition/gdcmElement.h
@@ -690,7 +690,7 @@ template<>
class Element<VR::AS, VM::VM5>
{
public:
- char Internal[VMToLength<VM::VM5>::Length];
+ char Internal[VMToLength<VM::VM5>::Length * sizeof( VRToType<VR::AS>::Type )];
void Print(std::ostream &_os) const {
_os << Internal;
}

Discussion

    • status: open --> closed
     
    • milestone: 1424690 --> 2.0.19
    • labels: 1264207 --> General (default)
     
  • This is a dup of 3434779