summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--psi/zfont2.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/psi/zfont2.c b/psi/zfont2.c
index db7b81e7d..05cea3881 100644
--- a/psi/zfont2.c
+++ b/psi/zfont2.c
@@ -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);
}