XWD: Fix handling invalid bpp reported in GHSA-526v-vm72-4v64 #194
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Test | |
| on: | |
| push: | |
| branches: [ master, main ] | |
| pull_request: | |
| branches: [ master, main ] | |
| workflow_dispatch: | |
| jobs: | |
| build-linux-macos: | |
| name: Build and Test on ${{ matrix.os }} - ${{ matrix.config.name }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| config: | |
| - { name: "Shared ASAN", build_shared: "ON", combine_codecs: "OFF", sail_asan: "ON", sail_tsan: "OFF" } | |
| - { name: "Shared TSAN", build_shared: "ON", combine_codecs: "OFF", sail_asan: "OFF", sail_tsan: "ON" } | |
| - { name: "Shared Combined ASAN", build_shared: "ON", combine_codecs: "ON", sail_asan: "ON", sail_tsan: "OFF" } | |
| - { name: "Shared Combined TSAN", build_shared: "ON", combine_codecs: "ON", sail_asan: "OFF", sail_tsan: "ON" } | |
| - { name: "Static ASAN", build_shared: "OFF", combine_codecs: "OFF", sail_asan: "ON", sail_tsan: "OFF" } | |
| - { name: "Static TSAN", build_shared: "OFF", combine_codecs: "OFF", sail_asan: "OFF", sail_tsan: "ON" } | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install dependencies (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libswresample-dev \ | |
| libavif-dev libgif-dev libheif-dev libheif-plugin-x265 \ | |
| libjbig-dev libjpeg-dev libjxl-dev libnanosvg-dev libopenexr-dev \ | |
| libopenjp2-7-dev libopenjpip-dec-server libopenjpip-server \ | |
| libpng-dev libraw-dev libsdl2-dev libtiff-dev libwebp-dev zlib1g-dev | |
| - name: Install dependencies (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew install ffmpeg giflib jbigkit jpeg-turbo jpeg-xl libavif libheif libpng libraw libtiff openexr openjpeg resvg webp | |
| - name: Configure CMake | |
| run: | | |
| cmake -S . -B build \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DCMAKE_INSTALL_PREFIX=/usr/local \ | |
| -DBUILD_SHARED_LIBS=${{ matrix.config.build_shared }} \ | |
| -DSAIL_COMBINE_CODECS=${{ matrix.config.combine_codecs }} \ | |
| -DSAIL_ASAN=${{ matrix.config.sail_asan }} \ | |
| -DSAIL_TSAN=${{ matrix.config.sail_tsan }} | |
| - name: Build | |
| run: cmake --build build -j$(nproc) | |
| - name: Install | |
| run: | | |
| sudo make -C build install | |
| - name: Run tests | |
| env: | |
| TSAN_OPTIONS: allocator_may_return_null=1 | |
| run: ctest --test-dir build --output-on-failure -j$(nproc) | |
| - name: Test SAIL binary (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo ldconfig | |
| /usr/local/bin/sail --version | |
| - name: Test SAIL binary (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH | |
| /usr/local/bin/sail --version | |
| - name: Test external C API link | |
| run: | | |
| rm -rf tests/external/link/c/build | |
| mkdir tests/external/link/c/build | |
| cmake -S tests/external/link/c -B tests/external/link/c/build \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DSAIL_ASAN=${{ matrix.config.sail_asan }} \ | |
| -DSAIL_TSAN=${{ matrix.config.sail_tsan }} | |
| cmake --build tests/external/link/c/build -j$(nproc) | |
| tests/external/link/c/build/external-c-api-link | |
| - name: Test external C++ API link | |
| run: | | |
| rm -rf tests/external/link/c++/build | |
| mkdir tests/external/link/c++/build | |
| cmake -S tests/external/link/c++ -B tests/external/link/c++/build \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DSAIL_ASAN=${{ matrix.config.sail_asan }} \ | |
| -DSAIL_TSAN=${{ matrix.config.sail_tsan }} | |
| cmake --build tests/external/link/c++/build -j$(nproc) | |
| tests/external/link/c++/build/external-c++-api-link | |
| build-windows: | |
| name: Build and Test on Windows - ${{ matrix.config.name }} | |
| runs-on: windows-latest | |
| env: | |
| VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/vcpkg/archives | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| config: | |
| - { name: "Shared", build_shared: "ON", combine_codecs: "OFF", static_crt: "OFF", triplet: "x64-windows", appflags: "/MDd" } | |
| - { name: "Shared Combined", build_shared: "ON", combine_codecs: "ON", static_crt: "OFF", triplet: "x64-windows", appflags: "/MDd" } | |
| - { name: "Static /MT", build_shared: "OFF", combine_codecs: "OFF", static_crt: "ON", triplet: "x64-windows-static", appflags: "/MTd" } | |
| - { name: "Static /MD", build_shared: "OFF", combine_codecs: "OFF", static_crt: "OFF", triplet: "x64-windows-static-md", appflags: "/MDd" } | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Cache vcpkg | |
| uses: actions/cache@v4 | |
| with: | |
| path: vcpkg | |
| key: vcpkg-${{ matrix.config.triplet }}-${{ hashFiles('vcpkg.json') }} | |
| - name: Set up vcpkg | |
| shell: bash | |
| run: | | |
| if [ ! -f "vcpkg/vcpkg.exe" ]; then | |
| rm -rf vcpkg | |
| git clone https://github.com/microsoft/vcpkg.git | |
| cd vcpkg | |
| ./bootstrap-vcpkg.bat | |
| fi | |
| - name: Configure CMake | |
| shell: bash | |
| run: | | |
| mkdir -p "$VCPKG_DEFAULT_BINARY_CACHE" | |
| cmake -S . -B build \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DCMAKE_INSTALL_PREFIX=C:/SAIL \ | |
| -DBUILD_SHARED_LIBS=${{ matrix.config.build_shared }} \ | |
| -DSAIL_COMBINE_CODECS=${{ matrix.config.combine_codecs }} \ | |
| -DSAIL_WINDOWS_STATIC_CRT=${{ matrix.config.static_crt }} \ | |
| -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" \ | |
| -DVCPKG_TARGET_TRIPLET=${{ matrix.config.triplet }} \ | |
| -DVCPKG_MANIFEST_DIR="${{ github.workspace }}" \ | |
| -DVCPKG_INSTALL_OPTIONS="--clean-buildtrees-after-build" | |
| - name: Build | |
| run: cmake --build build --config Debug --target install "-j$env:NUMBER_OF_PROCESSORS" | |
| - name: Run tests | |
| run: | | |
| $env:PATH = "C:/SAIL/lib/sail/codecs/lib;$env:PATH" | |
| ctest --test-dir build/tests -C Debug --output-on-failure "-j$env:NUMBER_OF_PROCESSORS" | |
| - name: Test SAIL binary | |
| run: | | |
| $env:PATH = "C:/SAIL/lib/sail/codecs/lib;$env:PATH" | |
| C:/SAIL/bin/sail.exe --version | |
| - name: Test external C API link | |
| working-directory: tests/external/link/c | |
| run: | | |
| mkdir build | |
| cmake -S . -B build ` | |
| -DCMAKE_BUILD_TYPE=Debug ` | |
| -DCMAKE_PREFIX_PATH=C:/SAIL/lib/cmake ` | |
| -DCMAKE_C_FLAGS_DEBUG=${{ matrix.config.appflags }} ` | |
| -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake ` | |
| -DVCPKG_TARGET_TRIPLET=${{ matrix.config.triplet }} ` | |
| -DVCPKG_MANIFEST_DIR=${{ github.workspace }} | |
| cmake --build build --config Debug "-j$env:NUMBER_OF_PROCESSORS" | |
| - name: Test external C++ API link | |
| working-directory: tests/external/link/c++ | |
| run: | | |
| mkdir build | |
| cmake -S . -B build ` | |
| -DCMAKE_BUILD_TYPE=Debug ` | |
| -DCMAKE_PREFIX_PATH=C:/SAIL/lib/cmake ` | |
| -DCMAKE_CXX_FLAGS_DEBUG=${{ matrix.config.appflags }} ` | |
| -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake ` | |
| -DVCPKG_TARGET_TRIPLET=${{ matrix.config.triplet }} ` | |
| -DVCPKG_MANIFEST_DIR=${{ github.workspace }} | |
| cmake --build build --config Debug "-j$env:NUMBER_OF_PROCESSORS" |