From 87524fa1662578401c4fb21108bd6984afee7ce0 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Wed, 5 Oct 2016 18:53:11 +0100 Subject: Bug 697177: Avoid SEGV in Epub file. Thanks to Vlad Glagolev for the example file, analysis and patch. We had failed to initialise the "last break class" value, so that when we use it as an index into an array, we run the risk of crashing. The fix is simply to initialise it. By initialising it to OP we don't allow any softbreaks to be added when it's uninitialised, which feels right to me. --- source/html/html-layout.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/html') diff --git a/source/html/html-layout.c b/source/html/html-layout.c index 2211ea4f..8b74caa0 100644 --- a/source/html/html-layout.c +++ b/source/html/html-layout.c @@ -2289,6 +2289,7 @@ fz_parse_html(fz_context *ctx, fz_html_font_set *set, fz_archive *zip, const cha g.base_uri = base_uri; g.at_bol = 0; g.emit_white = 0; + g.last_brk_cls = UCDN_LINEBREAK_CLASS_OP; xml = fz_parse_xml(ctx, buf->data, buf->len, 1); -- cgit v1.2.3