diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2025-04-10 13:38:53 +0200 |
---|---|---|
committer | Sebastian Rasmussen <sebras@gmail.com> | 2025-04-10 13:44:11 +0200 |
commit | 281860659a0981d2b6d03a1383632f1ca9156d67 (patch) | |
tree | 08e9606ef9e1ae9eecde41e179500e13af4fbd5f | |
parent | c90826501bfec89c995c4f96eba72784243c1082 (diff) |
Bug 708442: Avoid crash due to unallocated stroke state.
Commit 5576bba26c0fe38243b25365c6b0faf0638114b5 accidentally omitted
allocating a new stroke state when a new line is allocated. ASAN
detects the NULL dereference that causes a crash.
The fix is to ensure that the stoke state is allocated when a new
line is allocated. This is reasonable since the original code just
depended on fz_default_stroke_state. After this fix ASAN no longer
complains.
-rw-r--r-- | source/html/html-layout.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/html/html-layout.c b/source/html/html-layout.c index 7306e724a..bc7d7cdc6 100644 --- a/source/html/html-layout.c +++ b/source/html/html-layout.c @@ -1969,7 +1969,11 @@ static int draw_flow_box(fz_context *ctx, fz_html_box *box, float page_top, floa if (style->text_decoration > 0) { if (!line) + { line = fz_new_path(ctx); + if (line_ss == NULL) + line_ss = fz_new_stroke_state(ctx); + } if (style->text_decoration & TD_UNDERLINE) { fz_moveto(ctx, line, node->x, node->y + 1.5f - page_top); |