diff options
author | Robin Watts <Robin.Watts@artifex.com> | 2022-01-18 11:33:25 +0000 |
---|---|---|
committer | Robin Watts <Robin.Watts@artifex.com> | 2022-01-19 14:44:48 +0000 |
commit | 10bc8def15b55415aa2776b675144ebc6ec9b4a8 (patch) | |
tree | 62b9bdd1249dd7a87313664e95790a367c9aca1e /gpdl | |
parent | ddf7a53c04ee8aec4971e8a37fcee6d29695086a (diff) | |
download | ghostpdl-10bc8def15b55415aa2776b675144ebc6ec9b4a8.tar.gz |
gpdl: Fix overrun while looking for UEL in various gpdl interpreters.
Spotted by valgrinding the file/command line from bug 704692. Sadly,
this doesn't fix the actual problem though.
Diffstat (limited to 'gpdl')
-rw-r--r-- | gpdl/jbig2top.c | 4 | ||||
-rw-r--r-- | gpdl/jp2ktop.c | 4 | ||||
-rw-r--r-- | gpdl/jpgtop.c | 4 | ||||
-rw-r--r-- | gpdl/pngtop.c | 4 | ||||
-rw-r--r-- | gpdl/psitop.c | 2 | ||||
-rw-r--r-- | gpdl/pwgtop.c | 4 | ||||
-rw-r--r-- | gpdl/tifftop.c | 4 |
7 files changed, 13 insertions, 13 deletions
diff --git a/gpdl/jbig2top.c b/gpdl/jbig2top.c index 15f1eefea..9ac01ccb6 100644 --- a/gpdl/jbig2top.c +++ b/gpdl/jbig2top.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2019-2021 Artifex Software, Inc. +/* Copyright (C) 2019-2022 Artifex Software, Inc. All Rights Reserved. This software is provided AS-IS with no warranty, either express or @@ -270,7 +270,7 @@ bytes_until_uel(const stream_cursor_read *pr) p++; if (p == q) break; - avail = pr->limit - pr->ptr; + avail = q - p; if (memcmp(p, "\033%-12345X", min(avail, 9)) == 0) { /* At least a partial match to a UEL. Everything up to * the start of the match is up for grabs. */ diff --git a/gpdl/jp2ktop.c b/gpdl/jp2ktop.c index 899e83745..3bc7009e4 100644 --- a/gpdl/jp2ktop.c +++ b/gpdl/jp2ktop.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2019-2021 Artifex Software, Inc. +/* Copyright (C) 2019-2022 Artifex Software, Inc. All Rights Reserved. This software is provided AS-IS with no warranty, either express or @@ -350,7 +350,7 @@ bytes_until_uel(const stream_cursor_read *pr) p++; if (p == q) break; - avail = pr->limit - pr->ptr; + avail = q - p; if (memcmp(p, "\033%-12345X", min(avail, 9)) == 0) { /* At least a partial match to a UEL. Everything up to * the start of the match is up for grabs. */ diff --git a/gpdl/jpgtop.c b/gpdl/jpgtop.c index 517e293d7..7120b1304 100644 --- a/gpdl/jpgtop.c +++ b/gpdl/jpgtop.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2019-2021 Artifex Software, Inc. +/* Copyright (C) 2019-2022 Artifex Software, Inc. All Rights Reserved. This software is provided AS-IS with no warranty, either express or @@ -364,7 +364,7 @@ bytes_until_uel(const stream_cursor_read *pr) p++; if (p == q) break; - avail = pr->limit - pr->ptr; + avail = q - p; if (memcmp(p, "\033%-12345X", min(avail, 9)) == 0) { /* At least a partial match to a UEL. Everything up to * the start of the match is up for grabs. */ diff --git a/gpdl/pngtop.c b/gpdl/pngtop.c index f50242664..8822ac2ba 100644 --- a/gpdl/pngtop.c +++ b/gpdl/pngtop.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2019-2021 Artifex Software, Inc. +/* Copyright (C) 2019-2022 Artifex Software, Inc. All Rights Reserved. This software is provided AS-IS with no warranty, either express or @@ -293,7 +293,7 @@ bytes_until_uel(const stream_cursor_read *pr) p++; if (p == q) break; - avail = pr->limit - pr->ptr; + avail = q - p; if (memcmp(p, "\033%-12345X", min(avail, 9)) == 0) { /* At least a partial match to a UEL. Everything up to * the start of the match is up for grabs. */ diff --git a/gpdl/psitop.c b/gpdl/psitop.c index 367599abc..590f12627 100644 --- a/gpdl/psitop.c +++ b/gpdl/psitop.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. +/* Copyright (C) 2001-2022 Artifex Software, Inc. All Rights Reserved. This software is provided AS-IS with no warranty, either express or diff --git a/gpdl/pwgtop.c b/gpdl/pwgtop.c index 3f4cd90ed..2f44bb7e8 100644 --- a/gpdl/pwgtop.c +++ b/gpdl/pwgtop.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2019-2021 Artifex Software, Inc. +/* Copyright (C) 2019-2022 Artifex Software, Inc. All Rights Reserved. This software is provided AS-IS with no warranty, either express or @@ -340,7 +340,7 @@ bytes_until_uel(const stream_cursor_read *pr) p++; if (p == q) break; - avail = pr->limit - pr->ptr; + avail = q - p; if (memcmp(p, "\033%-12345X", min(avail, 9)) == 0) { /* At least a partial match to a UEL. Everything up to * the start of the match is up for grabs. */ diff --git a/gpdl/tifftop.c b/gpdl/tifftop.c index 5876eb87a..4398cb187 100644 --- a/gpdl/tifftop.c +++ b/gpdl/tifftop.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2019-2021 Artifex Software, Inc. +/* Copyright (C) 2019-2022 Artifex Software, Inc. All Rights Reserved. This software is provided AS-IS with no warranty, either express or @@ -351,7 +351,7 @@ bytes_until_uel(const stream_cursor_read *pr) p++; if (p == q) break; - avail = pr->limit - pr->ptr; + avail = q - p; if (memcmp(p, "\033%-12345X", min(avail, 9)) == 0) { /* At least a partial match to a UEL. Everything up to * the start of the match is up for grabs. */ |