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

View File

@@ -15,6 +15,7 @@
namespace YAML {
class CollectionStack;
template <int> class DepthGuard; // depthguard.h
class EventHandler;
class Node;
class Scanner;
@@ -55,6 +56,7 @@ class SingleDocParser {
anchor_t LookupAnchor(const Mark& mark, const std::string& name) const;
private:
int depth = 0;
Scanner& m_scanner;
const Directives& m_directives;
std::unique_ptr<CollectionStack> m_pCollectionStack;