Skip to content
Snippets Groups Projects
Commit b44acdb0 authored by Henry's avatar Henry
Browse files

PtrList: Check for EOF while reading to avoid run-on and infinite loop when...

PtrList: Check for EOF while reading to avoid run-on and infinite loop when reading list of dictionaries.
Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1538
parent 3482e22b
Branches
Tags
No related merge requests found
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -115,6 +115,17 @@ void Foam::PtrList<T>::read(Istream& is, const INew& inewt)
)
{
is.putBack(lastToken);
if (is.eof())
{
FatalIOErrorIn
(
"PtrList<T>::read(Istream&, const INew&)",
is
) << "Premature EOF after reading " << lastToken.info()
<< exit(FatalIOError);
}
sllPtrs.append(inewt(is).ptr());
is >> lastToken;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment