]> andersk Git - libyaml.git/blobdiff - src/api.c
Update upstream source from tag 'upstream/0.2.2'
[libyaml.git] / src / api.c
index ee170d87de9095ca9c163b11a8cc99d854e4a910..e793b085fbb3cab94ee8cfe2169ffffcf0673b43 100644 (file)
--- a/src/api.c
+++ b/src/api.c
@@ -118,7 +118,12 @@ yaml_string_join(
 YAML_DECLARE(int)
 yaml_stack_extend(void **start, void **top, void **end)
 {
-    void *new_start = yaml_realloc(*start, ((char *)*end - (char *)*start)*2);
+    void *new_start;
+
+    if ((char *)*end - (char *)*start >= INT_MAX / 2)
+       return 0;
+
+    new_start = yaml_realloc(*start, ((char *)*end - (char *)*start)*2);
 
     if (!new_start) return 0;
 
@@ -1117,13 +1122,8 @@ error:
 YAML_DECLARE(void)
 yaml_document_delete(yaml_document_t *document)
 {
-    struct {
-        yaml_error_type_t error;
-    } context;
     yaml_tag_directive_t *tag_directive;
 
-    context.error = YAML_NO_ERROR;  /* Eliminate a compliler warning. */
-
     assert(document);   /* Non-NULL document object is expected. */
 
     while (!STACK_EMPTY(&context, document->nodes)) {
This page took 0.029182 seconds and 4 git commands to generate.