In perl.git, the branch blead has been updated <https://perl5.git.perl.org/perl.git/commitdiff/b9965e1496efe3cb6116e74d50aa83152c70e877?hp=66f85150154f441b79024356cbc59fbafcff7c2a>
- Log ----------------------------------------------------------------- commit b9965e1496efe3cb6116e74d50aa83152c70e877 Author: Tony Cook <t...@develop-help.com> Date: Wed Aug 8 14:21:33 2018 +1000 (perl #133422) handle Off_t smaller than size_t ----------------------------------------------------------------------- Summary of changes: ext/PerlIO-scalar/scalar.pm | 2 +- 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; -- Perl5 Master Repository