X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FVCBackend.cpp;h=957c69f585b48890ed38fdcfa1730da82f1dbf4c;hb=0b54650f0e7f1eae39f93444cac6c8525811975b;hp=9f9a3ff082ecce8d89473f46ce23c347721df58a;hpb=a4e7114d985640bfc5a8305d87fa7c04b18f6708;p=lyx.git diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp index 9f9a3ff082..957c69f585 100644 --- a/src/VCBackend.cpp +++ b/src/VCBackend.cpp @@ -31,6 +31,7 @@ #include "support/TempFile.h" #include +#include #include using namespace std; @@ -170,6 +171,8 @@ void RCS::scanMaster() LYXERR(Debug::LYXVC, "LyXVC::RCS: scanMaster: " << master_); ifstream ifs(master_.toFilesystemEncoding().c_str()); + // limit the size of strings we read to avoid memory problems + ifs >> setw(65636); string token; bool read_enough = false; @@ -284,7 +287,7 @@ LyXVC::CommandResult RCS::checkIn(string const & msg, string & log) bool RCS::checkInEnabled() { - return owner_ && !owner_->isReadonly(); + return owner_ && !owner_->hasReadonlyFlag(); } @@ -326,7 +329,7 @@ string RCS::checkOut() bool RCS::checkOutEnabled() { - return owner_ && owner_->isReadonly(); + return owner_ && owner_->hasReadonlyFlag(); } @@ -389,7 +392,7 @@ void RCS::undoLast() bool RCS::undoLastEnabled() { - return true; + return owner_->hasReadonlyFlag(); } @@ -427,7 +430,8 @@ string RCS::revisionInfo(LyXVC::RevisionInfo const info) return rev_date_cache_; case LyXVC::Time: return rev_time_cache_; - default: ; + default: + break; } return string(); @@ -566,10 +570,10 @@ void CVS::scanMaster() if (contains(line, tmpf)) { // Ok extract the fields. smatch sm; - - // false positive from coverity - // coverity[CHECKED_RETURN] - regex_match(line, sm, reg); + if (!regex_match(line, sm, reg)) { + LYXERR(Debug::LYXVC, "\t Cannot parse line. Skipping."); + continue; + } //sm[0]; // whole matched string //sm[1]; // filename @@ -1099,7 +1103,8 @@ string CVS::revisionInfo(LyXVC::RevisionInfo const info) return rev_date_cache_; case LyXVC::Time: return rev_time_cache_; - default: ; + default: + break; } } return string(); @@ -1663,8 +1668,8 @@ string SVN::revisionInfo(LyXVC::RevisionInfo const info) return rev_date_cache_; case LyXVC::Time: return rev_time_cache_; - default: ; - + default: + break; } return string(); @@ -2132,8 +2137,8 @@ string GIT::revisionInfo(LyXVC::RevisionInfo const info) return rev_date_cache_; case LyXVC::Time: return rev_time_cache_; - default: ; - + default: + break; } return string();