[Cmake-commits] [cmake-commits] king committed cmDependsFortranParser.cxx 1.18 1.19 cmDependsFortranParser.y 1.20 1.21
cmake-commits at cmake.org
cmake-commits at cmake.org
Tue Feb 17 11:53:59 EST 2009
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv11145/Source
Modified Files:
cmDependsFortranParser.cxx cmDependsFortranParser.y
Log Message:
BUG: Do not use 'char' type as array subscript
This converts uses of 'char' as an array subscript to 'unsigned char' to
heed the warning from gcc. The subscript must be an unsigned type to
avoid indexing before the beginning of the array. This change avoids a
potential crash if input text contains a byte value beyond 0x7f.
Index: cmDependsFortranParser.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDependsFortranParser.cxx,v
retrieving revision 1.18
retrieving revision 1.19
diff -C 2 -d -r1.18 -r1.19
*** cmDependsFortranParser.cxx 24 Apr 2008 03:53:20 -0000 1.18
--- cmDependsFortranParser.cxx 17 Feb 2009 16:53:57 -0000 1.19
***************
*** 243,248 ****
{
const char *cm = charmap;
! const char* us1 = s1;
! const char* us2 = s2;
while(cm[*us1] == cm[*us2++])
--- 243,248 ----
{
const char *cm = charmap;
! unsigned char const* us1 = reinterpret_cast<unsigned char const*>(s1);
! unsigned char const* us2 = reinterpret_cast<unsigned char const*>(s2);
while(cm[*us1] == cm[*us2++])
Index: cmDependsFortranParser.y
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDependsFortranParser.y,v
retrieving revision 1.20
retrieving revision 1.21
diff -C 2 -d -r1.20 -r1.21
*** cmDependsFortranParser.y 24 Apr 2008 03:53:20 -0000 1.20
--- cmDependsFortranParser.y 17 Feb 2009 16:53:57 -0000 1.21
***************
*** 102,107 ****
{
const char *cm = charmap;
! const char* us1 = s1;
! const char* us2 = s2;
while(cm[*us1] == cm[*us2++])
--- 102,107 ----
{
const char *cm = charmap;
! unsigned char const* us1 = reinterpret_cast<unsigned char const*>(s1);
! unsigned char const* us2 = reinterpret_cast<unsigned char const*>(s2);
while(cm[*us1] == cm[*us2++])
More information about the Cmake-commits
mailing list