summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Liddell <chris.liddell@artifex.com>2020-09-22 11:18:22 +0100
committerChris Liddell <chris.liddell@artifex.com>2020-09-22 18:00:45 +0100
commit71bbd0f12f48e1300a1e768483b5999099243f8d (patch)
tree807ddc299d3f68bced9a08317dfe0317d1c3ee3c
parenta5aa22546b191b9465b2d6f6aa00c2ad591238af (diff)
downloadghostpdl-71bbd0f12f48e1300a1e768483b5999099243f8d.tar.gz
Bug 702810: fix fapi buffer size parameter types
The buffer size parameters for the fapi callbacks used to be unsigned short, but were changed to ints a while back. The calls for the (g)subr data in Type 2/CFF fonts hadn't had the casts to ushort removed, causing the values to be trucated. There was also a Postscript/FAPI internal function that had not had the buffer length parameter changed to int.
-rw-r--r--base/write_t2.c6
-rw-r--r--psi/zfapi.c2
2 files changed, 3 insertions, 5 deletions
diff --git a/base/write_t2.c b/base/write_t2.c
index b53905bf1..72fd27bef 100644
--- a/base/write_t2.c
+++ b/base/write_t2.c
@@ -332,8 +332,7 @@ write_gsubrs_index(gs_fapi_font * a_fapi_font, WRF_output * a_output)
for (i = 0; i < count; i++) {
long buffer_size = a_output->m_limit - a_output->m_count < 0 ? 0 : a_output->m_limit - a_output->m_count;
- int length = a_fapi_font->get_gsubr(a_fapi_font, i, a_output->m_pos,
- (ushort) (buffer_size > 65535 ? 65535 : buffer_size));
+ int length = a_fapi_font->get_gsubr(a_fapi_font, i, a_output->m_pos, buffer_size);
if (length < 0)
return length;
@@ -387,8 +386,7 @@ write_subrs_index(gs_fapi_font * a_fapi_font, WRF_output * a_output)
for (i = 0; i < count; i++) {
long buffer_size = a_output->m_limit - a_output->m_count;
- int length = a_fapi_font->get_subr(a_fapi_font, i, a_output->m_pos,
- (ushort) buffer_size);
+ int length = a_fapi_font->get_subr(a_fapi_font, i, a_output->m_pos, buffer_size);
if (length < 0)
return length;
diff --git a/psi/zfapi.c b/psi/zfapi.c
index d38f56498..3c9856310 100644
--- a/psi/zfapi.c
+++ b/psi/zfapi.c
@@ -1704,7 +1704,7 @@ decode_bytes(byte *p, const byte *s, int l, int lenIV)
static int
get_type1_data(gs_fapi_font *ff, const ref *type1string,
- byte *buf, ushort buf_length)
+ byte *buf, int buf_length)
{
gs_font_type1 *pfont = (gs_font_type1 *) ff->client_font_data;
int lenIV = max(pfont->data.lenIV, 0);