diff options
author | Chris Liddell <chris.liddell@artifex.com> | 2017-06-15 09:05:20 +0100 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2017-06-15 09:05:20 +0100 |
commit | 937ccd17ac65935633b2ebc06cb7089b91e17e6b (patch) | |
tree | a474448f92417d36a35516ef33ec9c17455dec78 | |
parent | 7755e67116e8973ee0e3b22d653df026a84fa01b (diff) |
Bug 698056: make bounds check in gx_ttfReader__Read more robust
-rw-r--r-- | base/gxttfb.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/base/gxttfb.c b/base/gxttfb.c index 0e9a444e5..e1561af07 100644 --- a/base/gxttfb.c +++ b/base/gxttfb.c | |||
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n) | |||
79 | if (!r->error) { | 79 | if (!r->error) { |
80 | if (r->extra_glyph_index != -1) { | 80 | if (r->extra_glyph_index != -1) { |
81 | q = r->glyph_data.bits.data + r->pos; | 81 | q = r->glyph_data.bits.data + r->pos; |
82 | r->error = (r->glyph_data.bits.size - r->pos < n ? | 82 | r->error = ((r->pos >= r->glyph_data.bits.size || |
83 | r->glyph_data.bits.size - r->pos < n) ? | ||
83 | gs_note_error(gs_error_invalidfont) : 0); | 84 | gs_note_error(gs_error_invalidfont) : 0); |
84 | if (r->error == 0) | 85 | if (r->error == 0) |
85 | memcpy(p, q, n); | 86 | memcpy(p, q, n); |