From 1823fa3855893d3352d29c16edd8d3c16749983c Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Sat, 17 Sep 2016 21:09:24 +0800 Subject: svg: Ensure that read svg file is null-terminated. fz_parse_xml() assumes a null-terminated xml string. --- source/svg/svg-doc.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source') diff --git a/source/svg/svg-doc.c b/source/svg/svg-doc.c index 5404eefa..2216ad48 100644 --- a/source/svg/svg-doc.c +++ b/source/svg/svg-doc.c @@ -112,7 +112,10 @@ svg_open_document_with_stream(fz_context *ctx, fz_stream *file) buf = fz_read_all(ctx, file, 0); fz_try(ctx) + { + fz_write_buffer_byte(ctx, buf, 0); doc = svg_open_document_with_buffer(ctx, buf); + } fz_always(ctx) fz_drop_buffer(ctx, buf); fz_catch(ctx) -- cgit v1.2.3