diff options
author | Tony Cook <tony@develop-help.com> | 2018-08-08 14:21:33 +1000 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2018-08-09 11:20:35 -0600 |
commit | b9965e1496efe3cb6116e74d50aa83152c70e877 (patch) | |
tree | dfc82e0d65abbc9b3c64cdc8ea2bbaafd87cbcea /ext | |
parent | 66f85150154f441b79024356cbc59fbafcff7c2a (diff) | |
download | perl-b9965e1496efe3cb6116e74d50aa83152c70e877.tar.gz |
(perl #133422) handle Off_t smaller than size_t
Diffstat (limited to 'ext')
-rw-r--r-- | ext/PerlIO-scalar/scalar.pm | 2 | ||||
-rw-r--r-- | ext/PerlIO-scalar/scalar.xs | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/ext/PerlIO-scalar/scalar.pm b/ext/PerlIO-scalar/scalar.pm index 61b62ea3a2..6f4fa176be 100644 --- a/ext/PerlIO-scalar/scalar.pm +++ b/ext/PerlIO-scalar/scalar.pm @@ -1,5 +1,5 @@ package PerlIO::scalar; -our $VERSION = '0.29'; +our $VERSION = '0.30'; require XSLoader; XSLoader::load(); 1; diff --git a/ext/PerlIO-scalar/scalar.xs b/ext/PerlIO-scalar/scalar.xs index 10a4185899..e717736fab 100644 --- a/ext/PerlIO-scalar/scalar.xs +++ b/ext/PerlIO-scalar/scalar.xs @@ -185,11 +185,20 @@ PerlIOScalar_read(pTHX_ PerlIO *f, void *vbuf, Size_t count) /* I assume that Off_t is at least as large as len (which * seems safe) and that the size of the buffer in our SV is * always less than half the size of the address space + * + * Which turns out not to be the case on 64-bit Windows, since + * a build with USE_LARGE_FILES=undef defines Off_t as long, + * which is 32-bits on 64-bit Windows. This doesn't appear to + * be the case on other 64-bit platforms. */ - STATIC_ASSERT_STMT(sizeof(Off_t) >= sizeof(len)); +#if Off_t_size >= Size_t_size assert(len < ((~(STRLEN)0) >> 1)); if ((Off_t)len <= s->posn) return 0; +#else + if (len <= (STRLEN)s->posn) + return 0; +#endif got = len - (STRLEN)(s->posn); if ((STRLEN)got > (STRLEN)count) got = (STRLEN)count; |