aboutsummaryrefslogtreecommitdiffstats
path: root/src/writer.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-01-22 05:03:09 +0000
committerDavid Robillard <d@drobilla.net>2013-01-22 05:03:09 +0000
commit4459a37f7d3000cf052d556b01c95cdd4ae1a610 (patch)
tree7d7bd32a0f6b21ff76f86e2959d8035a80a76a9f /src/writer.c
parent6a9f4ff22970737ae781f99b599e291f353e9e1f (diff)
downloadserd-4459a37f7d3000cf052d556b01c95cdd4ae1a610.tar.gz
serd-4459a37f7d3000cf052d556b01c95cdd4ae1a610.tar.bz2
serd-4459a37f7d3000cf052d556b01c95cdd4ae1a610.zip
Fix possible crash in serd_writer_end_anon() when writing invalid lists
git-svn-id: http://svn.drobilla.net/serd/trunk@409 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src/writer.c')
-rw-r--r--src/writer.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/writer.c b/src/writer.c
index c6f010c0..a9574d76 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -602,12 +602,11 @@ serd_writer_end_anon(SerdWriter* writer,
if (writer->syntax == SERD_NTRIPLES) {
return SERD_SUCCESS;
}
- if (serd_stack_is_empty(&writer->anon_stack)) {
+ if (serd_stack_is_empty(&writer->anon_stack) || writer->indent == 0) {
w_err(writer, SERD_ERR_UNKNOWN,
"unexpected end of anonymous node\n");
return SERD_ERR_UNKNOWN;
}
- assert(writer->indent > 0);
--writer->indent;
write_sep(writer, SEP_ANON_END);
reset_context(writer, true);