X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2FVCBackend.cpp;h=a152a28d101e11f209f202243f6c0b011a91d2f3;hb=28be7d552f62cc02fa86d7f79201d089bfb2d7b5;hp=e0d9b4cce48138ce8d7b62fecb5c81d357a33be8;hpb=89985bebf92e8342514f2a17e88792093ed8c50d;p=lyx.git diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp index e0d9b4cce4..a152a28d10 100644 --- a/src/VCBackend.cpp +++ b/src/VCBackend.cpp @@ -31,6 +31,8 @@ #include "support/TempFile.h" #include +#include +#include using namespace std; using namespace lyx::support; @@ -169,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; @@ -283,7 +287,7 @@ LyXVC::CommandResult RCS::checkIn(string const & msg, string & log) bool RCS::checkInEnabled() { - return owner_ && !owner_->isReadonly(); + return owner_ && !owner_->hasReadonlyFlag(); } @@ -325,7 +329,7 @@ string RCS::checkOut() bool RCS::checkOutEnabled() { - return owner_ && owner_->isReadonly(); + return owner_ && owner_->hasReadonlyFlag(); } @@ -565,8 +569,10 @@ void CVS::scanMaster() if (contains(line, tmpf)) { // Ok extract the fields. smatch sm; - - 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 @@ -1432,7 +1438,7 @@ bool SVN::fileLock(bool lock, FileName const & tmpf, string &status) + " > " + quoteName(tmpf.toFilesystemEncoding()), FileName(owner_->filePath())); - // Lock error messages go unfortunately on stderr and are unreachible this way. + // Lock error messages go unfortunately on stderr and are unreachable this way. ifstream ifs(tmpf.toFilesystemEncoding().c_str()); string line; while (ifs) {