diff --git a/.github/workflows/testsuite.yml b/.github/workflows/testsuite.yml index 3cd0e3e..08905a2 100644 --- a/.github/workflows/testsuite.yml +++ b/.github/workflows/testsuite.yml @@ -19,10 +19,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - run: perl -V - name: install dependencies - uses: perl-actions/install-with-cpm@v1 + uses: perl-actions/install-with-cpm@stable with: cpanfile: "cpanfile" - name: Makefile.PL @@ -35,9 +35,7 @@ jobs: needs: [ubuntu] env: PERL_USE_UNSAFE_INC: 0 - AUTHOR_TESTING: 1 AUTOMATED_TESTING: 1 - RELEASE_TESTING: 1 runs-on: ubuntu-latest @@ -46,6 +44,10 @@ jobs: matrix: perl-version: [ + "5.40", + "5.38", + "5.36", + "5.34", "5.32", "5.30", "5.28", @@ -58,22 +60,19 @@ jobs: "5.14", "5.12", "5.10", - "5.8", ] - container: - image: perl:${{ matrix.perl-version }} - steps: - - uses: actions/checkout@v2 - - run: perl -V - - name: install dependencies - uses: perl-actions/install-with-cpm@v1 + - uses: actions/checkout@v4 + - name: Set up perl ${{ matrix.perl-version }} + uses: shogo82148/actions-setup-perl@v1 with: - sudo: false - cpanfile: "cpanfile" + perl-version: ${{ matrix.perl-version }} + - run: perl -V - name: Makefile.PL run: perl -I$(pwd) Makefile.PL + - name: make + run: make - name: make test run: make test @@ -81,25 +80,40 @@ jobs: needs: [ubuntu] env: PERL_USE_UNSAFE_INC: 0 - AUTHOR_TESTING: 1 AUTOMATED_TESTING: 1 - RELEASE_TESTING: 1 runs-on: macOS-latest - strategy: - fail-fast: false - matrix: - perl-version: [latest] - steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - run: perl -V - name: install dependencies - uses: perl-actions/install-with-cpm@v1 + uses: perl-actions/install-with-cpm@stable with: cpanfile: "cpanfile" - name: Makefile.PL run: perl -I$(pwd) Makefile.PL - name: make test run: make test + + windows: + needs: [ubuntu] + env: + PERL_USE_UNSAFE_INC: 0 + AUTOMATED_TESTING: 1 + + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Strawberry Perl + uses: shogo82148/actions-setup-perl@v1 + with: + perl-version: "5.38" + - run: perl -V + - name: Makefile.PL + run: perl Makefile.PL + - name: make + run: gmake + - name: make test + run: gmake test diff --git a/MD5.xs b/MD5.xs index 581b0e6..4427add 100644 --- a/MD5.xs +++ b/MD5.xs @@ -633,16 +633,17 @@ addfile(self, fh) PREINIT: MD5_CTX* context = get_md5_ctx(aTHX_ self); STRLEN fill = context->bytes_low & 0x3F; +#define BUFFER_SIZE 4096 #ifdef USE_HEAP_INSTEAD_OF_STACK unsigned char* buffer; #else - unsigned char buffer[4096]; + unsigned char buffer[BUFFER_SIZE]; #endif int n; CODE: if (fh) { #ifdef USE_HEAP_INSTEAD_OF_STACK - New(0, buffer, 4096, unsigned char); + New(0, buffer, BUFFER_SIZE, unsigned char); assert(buffer); #endif if (fill) { @@ -658,7 +659,7 @@ addfile(self, fh) } /* Process blocks until EOF or error */ - while ( (n = PerlIO_read(fh, buffer, sizeof(buffer))) > 0) { + while ( (n = PerlIO_read(fh, buffer, BUFFER_SIZE)) > 0) { MD5Update(context, buffer, n); } #ifdef USE_HEAP_INSTEAD_OF_STACK @@ -699,10 +700,10 @@ context(ctx, ...) STRLEN len; unsigned long blocks = SvUV(ST(1)); unsigned char *buf = (unsigned char *)(SvPV(ST(2), len)); - ctx->A = buf[ 0] | (buf[ 1]<<8) | (buf[ 2]<<16) | (buf[ 3]<<24); - ctx->B = buf[ 4] | (buf[ 5]<<8) | (buf[ 6]<<16) | (buf[ 7]<<24); - ctx->C = buf[ 8] | (buf[ 9]<<8) | (buf[10]<<16) | (buf[11]<<24); - ctx->D = buf[12] | (buf[13]<<8) | (buf[14]<<16) | (buf[15]<<24); + ctx->A = (U32)buf[ 0] | ((U32)buf[ 1]<<8) | ((U32)buf[ 2]<<16) | ((U32)buf[ 3]<<24); + ctx->B = (U32)buf[ 4] | ((U32)buf[ 5]<<8) | ((U32)buf[ 6]<<16) | ((U32)buf[ 7]<<24); + ctx->C = (U32)buf[ 8] | ((U32)buf[ 9]<<8) | ((U32)buf[10]<<16) | ((U32)buf[11]<<24); + ctx->D = (U32)buf[12] | ((U32)buf[13]<<8) | ((U32)buf[14]<<16) | ((U32)buf[15]<<24); ctx->bytes_low = blocks << 6; ctx->bytes_high = blocks >> 26; if (items == 4) { diff --git a/t/files.t b/t/files.t index 7d2bc0b..88788e3 100644 --- a/t/files.t +++ b/t/files.t @@ -22,7 +22,7 @@ EOT # This is the output of: 'md5sum README MD5.xs rfc1321.txt' $EXPECT = <