summaryrefslogtreecommitdiff
path: root/src/loader.c
Commit message (Collapse)AuthorAgeFilesLines
* Avoid recursion in the document loader. (#127)Michael Drake2020-04-101-103/+203
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The document loading API (yaml_parser_load) was susseptable to a stack overflow issue when given input data which opened many mappings and/or sequences without closing them. This was due to the use of recurion in the implementation. With this change, we avoid recursion, and maintain our own loader context stack on the heap. The loader context contains a stack of document node indexes. Each time a sequence or mapping start event is encountered, the node index corrasponding to the event is pushed to the stack. Each time a sequence or mapping end event is encountered, the corrasponding node's index is popped from the stack. The yaml_parser_load_nodes() function sits on the event stream, issuing events to the appropriate handlers by type. When an event handler function constructs a node, it needs to connect the new node to its parent (unless it's the root node). This is where the loader context stack is used to find the parent node. The way that the new node is added to the tree depends on whether the parent node is a mapping (with a yaml_node_pair_t to fill), or a sequence (with a yaml_node_item_t). Fixes: https://github.com/yaml/libyaml/issues/107
* Fixed most compiler warnings -Wall -WextraReini Urban2018-01-081-4/+4
| | | | | | | | | | | repro: CFLAGS="-Wall -Wextra -Wunused-parameter -Wc++-compat" ./configure && make which we use for perl, and libyaml is now included in cperl. Tested with gcc-5 and clang-3.7 There are still a tons of format warnings (%d on 64bit) in example-deconstructor.c which I skipped.
* Picked typofix from Ruby's Psych parserSHIBATA Hiroshi2016-11-231-2/+2
| | | | | See also https://github.com/ruby/psych/commit/66fb7fb77533d0606748940288858794752d95cb
* Prevent node index overflow (Reported by Florian Weimer).Kirill Simonov2014-02-021-0/+12
|
* Fixed non-ANSI initializations (fixes #115).Kirill Simonov2009-02-231-1/+3
|
* Eliminate some warnings and add more doxygen definitions.Kirill Simonov2007-01-081-5/+5
|
* Add win32 fixes and project files for VC6.Kirill Simonov2007-01-071-2/+3
|
* Add functions for constructing, parsing and emitting YAML documents.Kirill Simonov2007-01-071-0/+429