avoid segfault on short data read when parsing tabulated potentials

This commit is contained in:
Axel Kohlmeyer
2022-12-03 20:45:52 -05:00
parent 6fe8b84c23
commit dac55cf64d
4 changed files with 12 additions and 0 deletions

View File

@ -398,6 +398,9 @@ void PairTable::read_table(Table *tb, char *file, char *keyword)
reader.skip_line();
for (int i = 0; i < tb->ninput; i++) {
line = reader.next_line();
if (!line)
error->one(FLERR, "Data missing when parsing pair table '{}' line {} of {}.", keyword, i + 1,
tb->ninput);
try {
ValueTokenizer values(line);
values.next_int();