[cmake-commits] hoffman committed cmCTestSubmitHandler.cxx 1.25 1.26
cmake-commits at cmake.org
cmake-commits at cmake.org
Sat Dec 2 13:17:57 EST 2006
Update of /cvsroot/CMake/CMake/Source/CTest
In directory public:/mounts/ram/cvs-serv12073/Source/CTest
Modified Files:
cmCTestSubmitHandler.cxx
Log Message:
ENH: put checks on vector before referencing begin iterator
Index: cmCTestSubmitHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestSubmitHandler.cxx,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- cmCTestSubmitHandler.cxx 19 Oct 2006 19:00:09 -0000 1.25
+++ cmCTestSubmitHandler.cxx 2 Dec 2006 18:17:53 -0000 1.26
@@ -200,14 +200,19 @@
cmCTestLog(this->CTest, ERROR_MESSAGE, " Error message was: "
<< error_buffer << std::endl);
*this->LogFile << " Error when uploading file: "
- << local_file.c_str()
- << std::endl
- << " Error message was: " << error_buffer << std::endl
- << " Curl output was: "
- << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << std::endl;
- cmCTestLog(this->CTest, ERROR_MESSAGE, "CURL output: ["
- << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
- << std::endl);
+ << local_file.c_str()
+ << std::endl
+ << " Error message was: " << error_buffer << std::endl
+ << " Curl output was: ";
+ // avoid dereference of empty vector
+ if(chunk.size())
+ {
+ *this->LogFile << cmCTestLogWrite(&*chunk.begin(), chunk.size());
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "CURL output: ["
+ << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
+ << std::endl);
+ }
+ *this->LogFile << std::endl;
::curl_easy_cleanup(curl);
::curl_global_cleanup();
return false;
@@ -379,14 +384,20 @@
cmCTestLog(this->CTest, ERROR_MESSAGE, " Error message was: "
<< error_buffer << std::endl);
*this->LogFile << " Error when uploading file: "
- << local_file.c_str()
- << std::endl
- << " Error message was: " << error_buffer << std::endl
- << " Curl output was: "
- << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << std::endl;
- cmCTestLog(this->CTest, ERROR_MESSAGE, "CURL output: ["
- << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
- << std::endl);
+ << local_file.c_str()
+ << std::endl
+ << " Error message was: " << error_buffer
+ << std::endl;
+ // avoid deref of begin for zero size array
+ if(chunk.size())
+ {
+ *this->LogFile << " Curl output was: "
+ << cmCTestLogWrite(&*chunk.begin(), chunk.size())
+ << std::endl;
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "CURL output: ["
+ << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
+ << std::endl);
+ }
::curl_easy_cleanup(curl);
::curl_global_cleanup();
return false;
@@ -499,13 +510,18 @@
cmCTestLog(this->CTest, ERROR_MESSAGE, " Error message was: "
<< error_buffer << std::endl);
*this->LogFile << "\tTrigerring failed with error: " << error_buffer
- << std::endl
- << " Error message was: " << error_buffer << std::endl
- << " Curl output was: "
- << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << std::endl;
- cmCTestLog(this->CTest, ERROR_MESSAGE, "CURL output: ["
- << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
- << std::endl);
+ << std::endl
+ << " Error message was: " << error_buffer
+ << std::endl;
+ if(chunk.size())
+ {
+ *this->LogFile
+ << " Curl output was: "
+ << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << std::endl;
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "CURL output: ["
+ << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
+ << std::endl);
+ }
::curl_easy_cleanup(curl);
::curl_global_cleanup();
return false;
More information about the Cmake-commits
mailing list