46b1efb4f0
- CVE-2018-6192 (rh bz #1539845 #1539846) (gs bz #698916) - CVE-2018-6544 (rh bz #1542264 #1542265) (gs bz #698830 #698965) - CVE-2018-1000051 (rh bz #1544847 #1544848) (gs bz #698825 #698873)
81 lines
2.9 KiB
Diff
81 lines
2.9 KiB
Diff
From 321ba1de287016b0036bf4a56ce774ad11763384 Mon Sep 17 00:00:00 2001
|
|
Message-Id: <321ba1de287016b0036bf4a56ce774ad11763384.1518616543.git.mjg@fedoraproject.org>
|
|
From: Sebastian Rasmussen <sebras@gmail.com>
|
|
Date: Tue, 19 Dec 2017 23:47:47 +0100
|
|
Subject: [PATCH] Bug 698825: Do not drop borrowed colorspaces.
|
|
|
|
Previously the borrowed colorspace was dropped when updating annotation
|
|
appearances, leading to use after free warnings from valgrind/ASAN.
|
|
---
|
|
source/pdf/pdf-appearance.c | 8 ++------
|
|
1 file changed, 2 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/source/pdf/pdf-appearance.c b/source/pdf/pdf-appearance.c
|
|
index 70f684f4..d7a1dddd 100644
|
|
--- a/source/pdf/pdf-appearance.c
|
|
+++ b/source/pdf/pdf-appearance.c
|
|
@@ -2170,7 +2170,6 @@ void pdf_update_free_text_annot_appearance(fz_context *ctx, pdf_document *doc, p
|
|
fz_device *dev = NULL;
|
|
font_info font_rec;
|
|
fz_text *text = NULL;
|
|
- fz_colorspace *cs = NULL;
|
|
fz_matrix page_ctm;
|
|
|
|
pdf_page_transform(ctx, annot->page, NULL, &page_ctm);
|
|
@@ -2184,11 +2183,11 @@ void pdf_update_free_text_annot_appearance(fz_context *ctx, pdf_document *doc, p
|
|
fz_var(dlist);
|
|
fz_var(dev);
|
|
fz_var(text);
|
|
- fz_var(cs);
|
|
fz_try(ctx)
|
|
{
|
|
char *contents = pdf_to_str_buf(ctx, pdf_dict_get(ctx, obj, PDF_NAME_Contents));
|
|
char *da = pdf_to_str_buf(ctx, pdf_dict_get(ctx, obj, PDF_NAME_DA));
|
|
+ fz_colorspace *cs;
|
|
fz_point pos;
|
|
fz_rect rect;
|
|
|
|
@@ -2223,7 +2222,6 @@ void pdf_update_free_text_annot_appearance(fz_context *ctx, pdf_document *doc, p
|
|
fz_drop_display_list(ctx, dlist);
|
|
font_info_fin(ctx, &font_rec);
|
|
fz_drop_text(ctx, text);
|
|
- fz_drop_colorspace(ctx, cs);
|
|
}
|
|
fz_catch(ctx)
|
|
{
|
|
@@ -2359,7 +2357,6 @@ void pdf_set_signature_appearance(fz_context *ctx, pdf_document *doc, pdf_annot
|
|
fz_device *dev = NULL;
|
|
font_info font_rec;
|
|
fz_text *text = NULL;
|
|
- fz_colorspace *cs = NULL;
|
|
fz_path *path = NULL;
|
|
fz_buffer *fzbuf = NULL;
|
|
fz_matrix page_ctm;
|
|
@@ -2375,7 +2372,6 @@ void pdf_set_signature_appearance(fz_context *ctx, pdf_document *doc, pdf_annot
|
|
fz_var(dlist);
|
|
fz_var(dev);
|
|
fz_var(text);
|
|
- fz_var(cs);
|
|
fz_var(fzbuf);
|
|
fz_try(ctx)
|
|
{
|
|
@@ -2384,6 +2380,7 @@ void pdf_set_signature_appearance(fz_context *ctx, pdf_document *doc, pdf_annot
|
|
fz_rect logo_bounds;
|
|
fz_matrix logo_tm;
|
|
fz_rect rect;
|
|
+ fz_colorspace *cs = fz_device_rgb(ctx); /* Borrowed reference */
|
|
|
|
pdf_to_rect(ctx, pdf_dict_get(ctx, annot->obj, PDF_NAME_Rect), &annot_rect);
|
|
rect = annot_rect;
|
|
@@ -2396,7 +2393,6 @@ void pdf_set_signature_appearance(fz_context *ctx, pdf_document *doc, pdf_annot
|
|
fz_bound_path(ctx, path, NULL, &fz_identity, &logo_bounds);
|
|
center_rect_within_rect(&logo_bounds, &rect, &logo_tm);
|
|
fz_concat(&logo_tm, &logo_tm, &page_ctm);
|
|
- cs = fz_device_rgb(ctx); /* Borrowed reference */
|
|
fz_fill_path(ctx, dev, path, 0, &logo_tm, cs, logo_color, 1.0f, NULL);
|
|
|
|
get_font_info(ctx, doc, dr, da, &font_rec);
|
|
--
|
|
2.16.1.312.g365a692731
|
|
|