# HG changeset patch
# User Kirill Simonov <xi@resolvent.net>
# Date 1391408806 21600
# Mon Feb 03 00:26:46 2014 -0600
# Node ID 0df2fb962294f3a6df1450a3e08c6a0f74f9078c
# Parent f859ed1eb757a3562b98a28a8ce69274bfd4b3f2
Limit input size to SIZE_MAX/2.
diff -r f859ed1eb757 -r 0df2fb962294 src/reader.c
--- a/src/reader.c Sun Feb 02 23:41:44 2014 -0600
+++ b/src/reader.c Mon Feb 03 00:26:46 2014 -0600
@@ -460,6 +460,10 @@
}
+ if (parser->offset >= PTRDIFF_MAX)
+ return yaml_parser_set_reader_error(parser, "input is too long",
+ PTRDIFF_MAX, -1);
+
return 1;
}
diff -r f859ed1eb757 -r 0df2fb962294 src/yaml_private.h
--- a/src/yaml_private.h Sun Feb 02 23:41:44 2014 -0600
+++ b/src/yaml_private.h Mon Feb 03 00:26:46 2014 -0600
@@ -8,6 +8,7 @@
#include <assert.h>
#include <limits.h>
#include <stddef.h>
+#include <stdint.h>
/*
* Memory management.