From 4e4dc1dc1515d476ccc1918cae7ed8208cd4ea0c Mon Sep 17 00:00:00 2001 From: Alexander Karpinsky Date: Tue, 4 Jan 2022 16:55:13 +0300 Subject: [PATCH 1/4] Protect double inclusion of ImagingSIMD.h --- src/libImaging/ImagingSIMD.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libImaging/ImagingSIMD.h b/src/libImaging/ImagingSIMD.h index d082837d1..35a0fccfe 100644 --- a/src/libImaging/ImagingSIMD.h +++ b/src/libImaging/ImagingSIMD.h @@ -1,13 +1,18 @@ +#ifndef __IMAGING_SIMD_H__ +#define __IMAGING_SIMD_H__ + /* Microsoft compiler doesn't limit intrinsics for an architecture. This macro is set only on x86 and means SSE2 and above including AVX2. */ #if defined(_M_X64) || _M_IX86_FP == 2 #define __SSE4_2__ #endif + #if defined(__SSE4_2__) #include #include #include #endif + #if defined(__AVX2__) #include #endif @@ -25,3 +30,5 @@ mm256_cvtepu8_epi32(void *ptr) { return _mm256_cvtepu8_epi32(_mm_loadl_epi64((__m128i *) ptr)); } #endif + +#endif From afac531208db7774244f2318c864d43f05d6eaf8 Mon Sep 17 00:00:00 2001 From: Alexander Karpinsky Date: Tue, 4 Jan 2022 17:01:05 +0300 Subject: [PATCH 2/4] Exclude other arch tests --- .github/workflows/test-docker.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/workflows/test-docker.yml b/.github/workflows/test-docker.yml index 57396fddc..6a4f98016 100644 --- a/.github/workflows/test-docker.yml +++ b/.github/workflows/test-docker.yml @@ -10,10 +10,6 @@ jobs: fail-fast: false matrix: docker: [ - # Run slower jobs first to give them a headstart and reduce waiting time - ubuntu-20.04-focal-arm64v8, - ubuntu-20.04-focal-ppc64le, - ubuntu-20.04-focal-s390x, # Then run the remainder alpine, amazon-2-amd64, @@ -28,13 +24,6 @@ jobs: ubuntu-20.04-focal-amd64, ] dockerTag: [main] - include: - - docker: "ubuntu-20.04-focal-arm64v8" - qemu-arch: "aarch64" - - docker: "ubuntu-20.04-focal-ppc64le" - qemu-arch: "ppc64le" - - docker: "ubuntu-20.04-focal-s390x" - qemu-arch: "s390x" name: ${{ matrix.docker }} From e8fa86d630e1aed3c314d3b917ce822265348c4b Mon Sep 17 00:00:00 2001 From: Alexander Karpinsky Date: Tue, 4 Jan 2022 17:32:18 +0300 Subject: [PATCH 3/4] Exclude CIFuzz tests --- .github/workflows/cifuzz.yml | 49 ------------------------------------ 1 file changed, 49 deletions(-) delete mode 100644 .github/workflows/cifuzz.yml diff --git a/.github/workflows/cifuzz.yml b/.github/workflows/cifuzz.yml deleted file mode 100644 index 7e2fbf28f..000000000 --- a/.github/workflows/cifuzz.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: CIFuzz - -on: - push: - paths: - - "**.c" - - "**.h" - pull_request: - paths: - - "**.c" - - "**.h" - workflow_dispatch: - -jobs: - Fuzzing: - runs-on: ubuntu-latest - steps: - - name: Build Fuzzers - id: build - uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master - with: - oss-fuzz-project-name: 'pillow' - language: python - dry-run: false - - name: Run Fuzzers - id: run - uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master - with: - oss-fuzz-project-name: 'pillow' - fuzz-seconds: 600 - language: python - dry-run: false - - name: Upload New Crash - uses: actions/upload-artifact@v2 - if: failure() && steps.build.outcome == 'success' - with: - name: artifacts - path: ./out/artifacts - - name: Upload Legacy Crash - uses: actions/upload-artifact@v2 - if: steps.run.outcome == 'success' - with: - name: crash - path: ./out/crash* - - name: Fail on legacy crash - if: success() - run: | - [ ! -e out/crash-* ] - echo No legacy crash detected From b5f03c9e74e83471a249f5ecf90cfca1dd359f5f Mon Sep 17 00:00:00 2001 From: Alexander Karpinsky Date: Tue, 4 Jan 2022 18:02:19 +0300 Subject: [PATCH 4/4] Two items, not two bytes --- src/_imaging.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_imaging.c b/src/_imaging.c index 88af37f82..0b39e369b 100644 --- a/src/_imaging.c +++ b/src/_imaging.c @@ -761,7 +761,7 @@ _prepare_lut_table(PyObject *table, Py_ssize_t table_size) { } /* malloc check ok, max is 2 * 4 * 65**3 = 2197000 */ - prepared = (INT16 *)malloc(sizeof(INT16) * table_size + 2); + prepared = (INT16 *)malloc(sizeof(INT16) * (table_size + 2)); if (!prepared) { if (free_table_data) { free(table_data);