mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -115,6 +115,17 @@ void Foam::PtrList<T>::read(Istream& is, const INew& inewt)
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
is.putBack(lastToken);
|
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());
|
sllPtrs.append(inewt(is).ptr());
|
||||||
is >> lastToken;
|
is >> lastToken;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user