Fix stack overflow (#807)

Fix stack overflow in HandleNode by explicitly limiting the depth of recursion.
This commit is contained in:
Alan Griffiths
2020-04-09 19:02:10 +01:00
committed by GitHub
parent 70205f5d88
commit 4edff1fa5d
5 changed files with 140 additions and 0 deletions

10
src/depthguard.cpp Normal file
View File

@@ -0,0 +1,10 @@
#include "yaml-cpp/depthguard.h"
namespace YAML {
DeepRecursion::DeepRecursion(int depth, const Mark& mark_, const std::string& msg_)
: ParserException(mark_, msg_),
m_depth(depth) {
}
} // namespace YAML