diff options
author | Thomas Deutschmann <whissi@gentoo.org> | 2020-03-19 13:53:45 +0100 |
---|---|---|
committer | Thomas Deutschmann <whissi@gentoo.org> | 2020-08-13 11:28:25 +0200 |
commit | dc2ba49207af71193f1390d84bba4e15aeea0ce0 (patch) | |
tree | 79c2a51cb5fa2b87800b1113e0015a7108cd2eb3 /contrib/lips4/gdevlprn.c | |
parent | Import Ghostscript 9.50 (diff) | |
download | ghostscript-gpl-patches-dc2ba49207af71193f1390d84bba4e15aeea0ce0.tar.gz ghostscript-gpl-patches-dc2ba49207af71193f1390d84bba4e15aeea0ce0.tar.bz2 ghostscript-gpl-patches-dc2ba49207af71193f1390d84bba4e15aeea0ce0.zip |
Import Ghostscript 9.52ghostscript-9.52
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'contrib/lips4/gdevlprn.c')
-rw-r--r-- | contrib/lips4/gdevlprn.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/contrib/lips4/gdevlprn.c b/contrib/lips4/gdevlprn.c index df8f862e..7461e46e 100644 --- a/contrib/lips4/gdevlprn.c +++ b/contrib/lips4/gdevlprn.c @@ -334,9 +334,16 @@ lprn_is_black(gx_device_printer * pdev, int r, int h, int bx) y0 = (r + h - bh) % maxY; for (y = 0; y < bh; y++) { p = &lprn->ImageBuf[(y0 + y) * bpl + bx * lprn->nBw]; - for (x = 0; x < lprn->nBw; x++) + for (x = 0; x < lprn->nBw; x++) { + /* bpl isn't necessarily a multiple of lprn->nBw, so + we need to explicitly stop after the last byte in this + line to avoid accessing either the next line's data or + going off the end of our buffer completely. This avoids + https://bugs.ghostscript.com/show_bug.cgi?id=701785. */ + if (bx * lprn->nBw + x >= bpl) break; if (p[x] != 0) return 1; + } } return 0; } |