summaryrefslogtreecommitdiff
path: root/src/buffer.c
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-04-03 10:01:09 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2017-04-03 10:01:09 +0200
commit5c2f3341e3c129aeb27f70fe6ca9ed0fea8f2383 (patch)
treed69404aa64ac077e5fcef48105edd780094b1480 /src/buffer.c
parent118ebb338840d67005ee57ec39060d2b68f4ec7c (diff)
Print message to stderr when we abort due to memory demands.
Closes #188. @nwellnhof - could you have a look and let me know if you think this is a bad idea or could be improved?
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/buffer.c b/src/buffer.c
index a6754b6..629f809 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -42,7 +42,12 @@ void cmark_strbuf_grow(cmark_strbuf *buf, bufsize_t target_size) {
if (target_size < buf->asize)
return;
- if (target_size > (bufsize_t)(INT32_MAX / 2))
+ if (target_size > (bufsize_t)(INT32_MAX / 2)) {
+ fprintf(stderr,
+ "[cmark] cmark_strbuf_grow requests buffer with size > %d, aborting\n",
+ (bufsize_t)(INT32_MAX / 2));
+ abort();
+ }
abort();
/* Oversize the buffer by 50% to guarantee amortized linear time