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;
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)) {