coin-or-Clp/coin-or-Clp-overflow.patch

106 lines
4.0 KiB
Diff

diff -up Clp-releases-1.17.5/Clp/src/ClpModel.cpp.orig Clp-releases-1.17.5/Clp/src/ClpModel.cpp
--- Clp-releases-1.17.5/Clp/src/ClpModel.cpp.orig 2020-02-20 09:54:26.138615175 -0700
+++ Clp-releases-1.17.5/Clp/src/ClpModel.cpp 2020-02-20 09:56:18.361626298 -0700
@@ -1337,7 +1337,7 @@ void ClpModel::resize(int newNumberRows,
if (numberRowNames < newNumberRows) {
rowNames_.resize(newNumberRows);
lengthNames_ = CoinMax(lengthNames_, 8);
- char name[10];
+ char name[12];
for (unsigned int iRow = numberRowNames; iRow < newNumberRows; iRow++) {
sprintf(name, "R%7.7d", iRow);
rowNames_[iRow] = name;
@@ -1347,7 +1347,7 @@ void ClpModel::resize(int newNumberRows,
if (numberColumnNames < newNumberColumns) {
columnNames_.resize(newNumberColumns);
lengthNames_ = CoinMax(lengthNames_, 8);
- char name[10];
+ char name[12];
for (unsigned int iColumn = numberColumnNames;
iColumn < newNumberColumns; iColumn++) {
sprintf(name, "C%7.7d", iColumn);
@@ -3445,7 +3445,7 @@ ClpModel::getRowName(int iRow) const
if (size > iRow) {
return rowNames_[iRow];
} else {
- char name[10];
+ char name[12];
sprintf(name, "R%7.7d", iRow);
std::string rowName(name);
return rowName;
@@ -3481,7 +3481,7 @@ ClpModel::getColumnName(int iColumn) con
if (size > iColumn) {
return columnNames_[iColumn];
} else {
- char name[10];
+ char name[12];
sprintf(name, "C%7.7d", iColumn);
std::string columnName(name);
return columnName;
@@ -3563,7 +3563,7 @@ void ClpModel::copyRowNames(const char *
maxLength = CoinMax(maxLength, static_cast< unsigned int >(strlen(rowNames[iRow - first])));
} else {
maxLength = CoinMax(maxLength, static_cast< unsigned int >(8));
- char name[10];
+ char name[12];
sprintf(name, "R%7.7d", iRow);
rowNames_[iRow] = name;
}
@@ -3590,7 +3590,7 @@ void ClpModel::copyColumnNames(const cha
maxLength = CoinMax(maxLength, static_cast< unsigned int >(strlen(columnNames[iColumn - first])));
} else {
maxLength = CoinMax(maxLength, static_cast< unsigned int >(8));
- char name[10];
+ char name[12];
sprintf(name, "C%7.7d", iColumn);
columnNames_[iColumn] = name;
}
@@ -3836,7 +3836,7 @@ ClpModel::rowNamesAsChar() const
if (rowName(iRow) != "") {
rowNames[iRow] = CoinStrdup(rowName(iRow).c_str());
} else {
- char name[10];
+ char name[12];
sprintf(name, "R%7.7d", iRow);
rowNames[iRow] = CoinStrdup(name);
}
@@ -3852,7 +3852,7 @@ ClpModel::rowNamesAsChar() const
xx[n] = '\0';
#endif
}
- char name[10];
+ char name[12];
for (; iRow < numberRows_; iRow++) {
sprintf(name, "R%7.7d", iRow);
rowNames[iRow] = CoinStrdup(name);
@@ -3875,7 +3875,7 @@ ClpModel::columnNamesAsChar() const
if (columnName(iColumn) != "") {
columnNames[iColumn] = CoinStrdup(columnName(iColumn).c_str());
} else {
- char name[10];
+ char name[12];
sprintf(name, "C%7.7d", iColumn);
columnNames[iColumn] = CoinStrdup(name);
}
@@ -3891,7 +3891,7 @@ ClpModel::columnNamesAsChar() const
xx[n] = '\0';
#endif
}
- char name[10];
+ char name[12];
for (; iColumn < numberColumns_; iColumn++) {
sprintf(name, "C%7.7d", iColumn);
columnNames[iColumn] = CoinStrdup(name);
diff -up Clp-releases-1.17.5/Clp/src/ClpSimplexOther.cpp.orig Clp-releases-1.17.5/Clp/src/ClpSimplexOther.cpp
--- Clp-releases-1.17.5/Clp/src/ClpSimplexOther.cpp.orig 2020-02-20 09:55:43.777239225 -0700
+++ Clp-releases-1.17.5/Clp/src/ClpSimplexOther.cpp 2020-02-20 09:56:18.363626263 -0700
@@ -2276,7 +2276,7 @@ int ClpSimplexOther::parametrics(const c
{
int returnCode = -2;
FILE *fp = fopen(dataFile, "r");
- char line[200];
+ char line[400];
if (!fp) {
handler_->message(CLP_UNABLE_OPEN, messages_)
<< dataFile << CoinMessageEol;