diff options
author | Ray Johnston <ray.johnston@artifex.com> | 2016-09-07 07:17:26 -0700 |
---|---|---|
committer | Ray Johnston <ray.johnston@artifex.com> | 2016-09-07 07:23:26 -0700 |
commit | 4b101952d81a5899972f81f7b18ef3becd5bd45e (patch) | |
tree | 9733a6f325f2e702960e80d69b39940b8b1a209f | |
parent | 527450e2ef1eca2ad26cdfba3a4f667e90bfd992 (diff) | |
download | ghostpdl-4b101952d81a5899972f81f7b18ef3becd5bd45e.tar.gz |
Fix sread_subfile check for file_limit when gs_offset_t is bigger than long.
The file_limit was initialized in sread_file and swrite_file to the largest
gs_offset_t value, but the check only compared to max_long.
-rw-r--r-- | base/sfxstdio.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/base/sfxstdio.c b/base/sfxstdio.c index 4e36d99d9..d6e48f448 100644 --- a/base/sfxstdio.c +++ b/base/sfxstdio.c @@ -70,7 +70,7 @@ sread_file(register stream * s, FILE * file, byte * buf, uint len) s->file = file; s->file_modes = s->modes; s->file_offset = 0; - s->file_limit = sizeof(gs_offset_t) > 4 ? max_int64_t : max_long; + s->file_limit = (sizeof(gs_offset_t) > 4 ? max_int64_t : max_long); } /* Confine reading to a subfile. This is primarily for reusable streams. */ @@ -78,9 +78,9 @@ int sread_subfile(stream *s, gs_offset_t start, gs_offset_t length) { if (s->file == 0 || s->modes != s_mode_read + s_mode_seek || - s->file_offset != 0 || s->file_limit != max_long || - ((s->position < start || s->position > start + length) && - sseek(s, start) < 0) + s->file_offset != 0 || + s->file_limit != (sizeof(gs_offset_t) > 4 ? max_int64_t : max_long) || + ((s->position < start || s->position > start + length) && sseek(s, start) < 0) ) return ERRC; s->position -= start; @@ -193,7 +193,7 @@ swrite_file(register stream * s, FILE * file, byte * buf, uint len) s->file = file; s->file_modes = s->modes; s->file_offset = 0; /* in case we switch to reading later */ - s->file_limit = sizeof(gs_offset_t) > 4 ? max_int64_t : max_long; /* ibid. */ + s->file_limit = (sizeof(gs_offset_t) > 4 ? max_int64_t : max_long); /* ibid. */ } /* Initialize for appending to an OS file. */ void |