avoid segfault when using a custom format with too many format specifiers
This commit is contained in:
@ -231,10 +231,12 @@ void DumpCustomMPIIO::init_style()
|
|||||||
// lo priority = line, medium priority = int/float, hi priority = column
|
// lo priority = line, medium priority = int/float, hi priority = column
|
||||||
|
|
||||||
auto words = utils::split_words(format);
|
auto words = utils::split_words(format);
|
||||||
if ((int) words.size() < nfield) error->all(FLERR, "Dump_modify format line is too short");
|
if ((int) words.size() < nfield)
|
||||||
|
error->all(FLERR, "Dump_modify format line is too short: {}", format);
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (const auto &word : words) {
|
for (const auto &word : words) {
|
||||||
|
if (i >= nfield) break;
|
||||||
delete[] vformat[i];
|
delete[] vformat[i];
|
||||||
|
|
||||||
if (format_column_user[i])
|
if (format_column_user[i])
|
||||||
|
|||||||
@ -262,10 +262,11 @@ void DumpCustom::init_style()
|
|||||||
|
|
||||||
auto words = utils::split_words(format);
|
auto words = utils::split_words(format);
|
||||||
if ((int) words.size() < nfield)
|
if ((int) words.size() < nfield)
|
||||||
error->all(FLERR,"Dump_modify format line is too short");
|
error->all(FLERR,"Dump_modify format line is too short: {}", format);
|
||||||
|
|
||||||
int i=0;
|
int i=0;
|
||||||
for (const auto &word : words) {
|
for (const auto &word : words) {
|
||||||
|
if (i >= nfield) break;
|
||||||
delete[] vformat[i];
|
delete[] vformat[i];
|
||||||
|
|
||||||
if (format_column_user[i])
|
if (format_column_user[i])
|
||||||
|
|||||||
@ -185,10 +185,11 @@ void DumpLocal::init_style()
|
|||||||
|
|
||||||
auto words = utils::split_words(format);
|
auto words = utils::split_words(format);
|
||||||
if ((int) words.size() < size_one)
|
if ((int) words.size() < size_one)
|
||||||
error->all(FLERR,"Dump_modify format line is too short");
|
error->all(FLERR,"Dump_modify format line is too short: {}", format);
|
||||||
|
|
||||||
int i=0;
|
int i=0;
|
||||||
for (const auto &word : words) {
|
for (const auto &word : words) {
|
||||||
|
if (i >= size_one) break;
|
||||||
delete[] vformat[i];
|
delete[] vformat[i];
|
||||||
|
|
||||||
if (format_column_user[i])
|
if (format_column_user[i])
|
||||||
|
|||||||
Reference in New Issue
Block a user