summaryrefslogtreecommitdiff
path: root/src/yaml_private.h
diff options
context:
space:
mode:
authorKirill Simonov <xi@resolvent.net>2014-02-02 20:53:10 -0600
committerKirill Simonov <xi@resolvent.net>2014-02-02 20:53:10 -0600
commit2d94fc50024ae139903ed55a7fd0748ec9fa70e4 (patch)
tree5b7899b1cbbdc60710682ef1c8c2dfc06eb96032 /src/yaml_private.h
parentdf33f257e5b99ecde7f9b6dbc6d449dce76a139f (diff)
downloadlibyaml-git-2d94fc50024ae139903ed55a7fd0748ec9fa70e4.tar.gz
Prevent node index overflow (Reported by Florian Weimer).
Diffstat (limited to 'src/yaml_private.h')
-rw-r--r--src/yaml_private.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/yaml_private.h b/src/yaml_private.h
index ed5ea66..f835d3d 100644
--- a/src/yaml_private.h
+++ b/src/yaml_private.h
@@ -421,6 +421,12 @@ yaml_queue_extend(void **start, void **head, void **tail, void **end);
#define STACK_EMPTY(context,stack) \
((stack).start == (stack).top)
+#define STACK_LIMIT(context,stack,size) \
+ ((stack).top - (stack).start < (size) ? \
+ 1 : \
+ ((context)->error = YAML_MEMORY_ERROR, \
+ 0))
+
#define PUSH(context,stack,value) \
(((stack).top != (stack).end \
|| yaml_stack_extend((void **)&(stack).start, \