ghostscript: CVE-2017-9727, -9835, -11714
cover ghostscript: CVE-2017-9727, -9835, -11714
Apply after 0001-ghostscript-fix-several-CVEs-by-adding-bounds-checki.patch
Joe Slater (1):
ghostscript: CVE-2017-9727, -9835, -11714
.../ghostscript/ghostscript/CVE-2017-11714.patch | 61 ++++++++++ .../ghostscript/ghostscript/CVE-2017-9727.patch | 35 ++++++ .../ghostscript/ghostscript/CVE-2017-9835.patch | 125 +++++++++++++++++++++ .../ghostscript/ghostscript_9.21.bb | 3 + 4 files changed, 224 insertions(+) create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2017-11714.patch create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9727.patch create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9835.patch
Signature · 1 line
2.7.4
PATCH 1/1 ghostscript: CVE-2017-9727, -9835, -11714
CVE-2017-9727: make bounds check in gx_ttfReader__Read more robust
CVE-2017-9835: bounds check the array allocations methods
CVE-2017-11714: prevent trying to reloc a freed object
--- .../ghostscript/ghostscript/CVE-2017-11714.patch | 61 ++++++++++ .../ghostscript/ghostscript/CVE-2017-9727.patch | 35 ++++++ .../ghostscript/ghostscript/CVE-2017-9835.patch | 125 +++++++++++++++++++++ .../ghostscript/ghostscript_9.21.bb | 3 + 4 files changed, 224 insertions(+) create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2017-11714.patch create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9727.patch create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9835.patch
meta/recipes-extended/ghostscript/ghostscript/CVE-2017-11714.patch new file +61 -0
@@ -0,0 +1,61 @@ +From 671fd59eb657743aa86fbc1895cb15872a317caa Mon Sep 17 00:00:00 2001 +From: Chris Liddell <[email protected]> +Date: Thu, 6 Jul 2017 14:54:02 +0100 +Subject: [PATCH] Bug 698158: prevent trying to reloc a freed object + +In the token reader, we pass the scanner state structure around as a +t_struct ref on the Postscript operand stack. + +But we explicitly free the scanner state when we're done, which leaves a +dangling reference on the operand stack and, unless that reference gets +overwritten before the next garbager run, we can end up with the garbager +trying to deal with an already freed object - that can cause a crash, or +memory corruption. +--- + psi/ztoken.c | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +--- end of original header + +CVE: CVE-2017-11714 + +Upstream-Status: Backport [git://git.ghostscript.com/ghostpdl.git] + +Signed-off-by: Joe Slater <[email protected]> + +diff --git a/psi/ztoken.c b/psi/ztoken.c +index 4dba7c5..af1ceeb 100644 +--- a/psi/ztoken.c ++++ b/psi/ztoken.c +@@ -107,6 +107,12 @@ token_continue(i_ctx_t *i_ctx_p, scanner_state * pstate, bool save) + int code; + ref token; + ++ /* Since we might free pstate below, and we're dealing with ++ * gc memory referenced by the stack, we need to explicitly ++ * remove the reference to pstate from the stack, otherwise ++ * the garbager will fall over ++ */ ++ make_null(osp); + /* Note that gs_scan_token may change osp! */ + pop(1); /* remove the file or scanner state */ + again: +@@ -183,8 +189,14 @@ ztokenexec_continue(i_ctx_t *i_ctx_p) + static int + tokenexec_continue(i_ctx_t *i_ctx_p, scanner_state * pstate, bool save) + { +- os_ptr op; ++ os_ptr op = osp; + int code; ++ /* Since we might free pstate below, and we're dealing with ++ * gc memory referenced by the stack, we need to explicitly ++ * remove the reference to pstate from the stack, otherwise ++ * the garbager will fall over ++ */ ++ make_null(osp); + /* Note that gs_scan_token may change osp! */ + pop(1); + again: +-- +1.7.9.5 +
meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9727.patch new file +35 -0
@@ -0,0 +1,35 @@ +From 937ccd17ac65935633b2ebc06cb7089b91e17e6b Mon Sep 17 00:00:00 2001 +From: Chris Liddell <[email protected]> +Date: Thu, 15 Jun 2017 09:05:20 +0100 +Subject: [PATCH] Bug 698056: make bounds check in gx_ttfReader__Read more + robust + +--- + base/gxttfb.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- end of original header + +CVE: CVE-2017-9727 + +Upstream-Status: Backport [git://git.ghostscript.com/ghostpdl.git] + +Signed-off-by: Joe Slater <[email protected]> + +diff --git a/base/gxttfb.c b/base/gxttfb.c +index 0e9a444..e1561af 100644 +--- a/base/gxttfb.c ++++ b/base/gxttfb.c +@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n) + if (!r->error) { + if (r->extra_glyph_index != -1) { + q = r->glyph_data.bits.data + r->pos; +- r->error = (r->glyph_data.bits.size - r->pos < n ? ++ r->error = ((r->pos >= r->glyph_data.bits.size || ++ r->glyph_data.bits.size - r->pos < n) ? + gs_note_error(gs_error_invalidfont) : 0); + if (r->error == 0) + memcpy(p, q, n); +-- +1.7.9.5 +
meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9835.patch new file +125 -0
125 lines not on this page · raw message
meta/recipes-extended/ghostscript/ghostscript_9.21.bb +3 -0
@@ -41,6 +41,9 @@ SRC_URI = "${SRC_URI_BASE} \ file://CVE-2017-9612.patch \ file://CVE-2017-9739.patch \ file://CVE-2017-9726.patch \ + file://CVE-2017-9727.patch \ + file://CVE-2017-9835.patch \ + file://CVE-2017-11714.patch \ " SRC_URI_class-native = "${SRC_URI_BASE} \
Signature · 1 line
2.7.4
✗ patchtest: failure for ghostscript: CVE-2017-9727, -9835, -11714
In reply to Joe Slater== Series Details ==
Series: ghostscript: CVE-2017-9727, -9835, -11714
Revision: 1
URL : https://patchwork.openembedded.org/series/8432/
State : failure
== Summary ==
Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:
* Issue Series does not apply on top of target branch [test_series_merge_on_head]
Suggested fix Rebase your series on top of targeted branch
Targeted branch master (currently at 5c9ef0734d)
If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).
---
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest Test suite: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe