summaryrefslogtreecommitdiff
path: root/src/xml.c
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2020-08-23 10:58:08 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2020-08-23 10:58:08 -0700
commitcef66d42f91d934ce8bd058cd7c76b87f78628a7 (patch)
tree6e9443de0362e62c49f269b0473e23ad5c84379e /src/xml.c
parent06e3af57a1ed7b07560974877b5280504eaefb63 (diff)
Add MAX_INDENT for xml.
Otherwise we can get quadratic increase in size with deeply nested structures. See #355.
Diffstat (limited to 'src/xml.c')
-rw-r--r--src/xml.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/xml.c b/src/xml.c
index 731bc01..f1dcfd2 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -10,6 +10,7 @@
#include "houdini.h"
#define BUFFER_SIZE 100
+#define MAX_INDENT 40
// Functions to convert cmark_nodes to XML strings.
@@ -30,7 +31,7 @@ struct render_state {
static CMARK_INLINE void indent(struct render_state *state) {
int i;
- for (i = 0; i < state->indent; i++) {
+ for (i = 0; i < state->indent && i < MAX_INDENT; i++) {
cmark_strbuf_putc(state->xml, ' ');
}
}