summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'psi/zfont2.c')
-rw-r--r--psi/zfont2.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/psi/zfont2.c b/psi/zfont2.c
index db7b81e7..ae5d29d0 100644
--- a/psi/zfont2.c
+++ b/psi/zfont2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2020 Artifex Software, Inc.
+/* Copyright (C) 2001-2021 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
@@ -1526,12 +1526,18 @@ get_float(ref *fnum, const cff_data_t *data, unsigned p, unsigned pe)
int sign = 0;
char *eptr, *bptr = buf;
- if (buf[0] == '-'){
+ if (q > buf && buf[0] == '-'){
sign = -1;
bptr = &(buf[1]);
}
- code = scan_number ((const byte *)bptr, (const byte *)q, sign, fnum, (const byte **)&eptr, 0);
+ if (q > buf) {
+ code = scan_number ((const byte *)bptr, (const byte *)q, sign, fnum, (const byte **)&eptr, 0);
+ }
+ else {
+ code = 0;
+ make_int(fnum, 0);
+ }
if (code < 0) {
return(code);
}