summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2020-09-10 18:10:49 +0200
committerThomas Deutschmann <whissi@gentoo.org>2020-09-11 20:06:36 +0200
commitacfc02c1747065fe450c7cfeb6f1844b62335f08 (patch)
tree5887806a2e6b99bbb0255e013a9028810e230a7f /psi/ziodev.c
parentImport Ghostscript 9.52 (diff)
downloadghostscript-gpl-patches-acfc02c1747065fe450c7cfeb6f1844b62335f08.tar.gz
ghostscript-gpl-patches-acfc02c1747065fe450c7cfeb6f1844b62335f08.tar.bz2
ghostscript-gpl-patches-acfc02c1747065fe450c7cfeb6f1844b62335f08.zip
Import Ghostscript 9.53ghostscript-9.53
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'psi/ziodev.c')
-rw-r--r--psi/ziodev.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/psi/ziodev.c b/psi/ziodev.c
index 2570d81e..7c829bc3 100644
--- a/psi/ziodev.c
+++ b/psi/ziodev.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2019 Artifex Software, Inc.
+/* Copyright (C) 2001-2020 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
@@ -92,6 +92,8 @@ zgetiodevice(i_ctx_t *i_ctx_p)
return 0;
}
+#define COMPILE_TIME_ASSERT(A,B) typedef char A[(B) ? 1 : -1]
+
/* ------ %lineedit and %statementedit ------ */
/* <file> <bool> <int> <string> .filelineedit <file> */
@@ -109,6 +111,9 @@ zgetiodevice(i_ctx_t *i_ctx_p)
* This could be increased by storing the input line in something
* other than a PostScript string.
*/
+COMPILE_TIME_ASSERT(STATEMENTEDIT_SIZE_CHECK, STATEMENTEDIT_BUF_SIZE <= max_string_size);
+COMPILE_TIME_ASSERT(LINEEDIT_BUF_SIZE_CHECK, LINEEDIT_BUF_SIZE <= max_string_size);
+
int
zfilelineedit(i_ctx_t *i_ctx_p)
{
@@ -139,8 +144,6 @@ zfilelineedit(i_ctx_t *i_ctx_p)
/* extend string */
initial_buf_size = statement ? STATEMENTEDIT_BUF_SIZE : LINEEDIT_BUF_SIZE;
- if (initial_buf_size > max_string_size)
- return_error(gs_error_limitcheck);
if (!buf->data || (buf->size < initial_buf_size)) {
count = 0;
buf->data = gs_alloc_string(imemory_system, initial_buf_size,