summaryrefslogtreecommitdiff
path: root/source/html
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-10-05 18:53:11 +0100
committerRobin Watts <robin.watts@artifex.com>2016-10-05 20:09:32 +0100
commit87524fa1662578401c4fb21108bd6984afee7ce0 (patch)
treee3f71ae49d89e1cfea7fd1d9e68e8b46b62df3d6 /source/html
parent9be02aade41637fc530774cf2f598a8f69f53bd0 (diff)
downloadmupdf-87524fa1662578401c4fb21108bd6984afee7ce0.tar.xz
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.
Diffstat (limited to 'source/html')
-rw-r--r--source/html/html-layout.c1
1 files changed, 1 insertions, 0 deletions
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);