Skip to content

Check imageSizeLimit earlier in avifjpeg.c #2214

Check imageSizeLimit earlier in avifjpeg.c

Check imageSizeLimit earlier in avifjpeg.c #2214

# This is a copy of ci-unix-shared-local.yml for building shared libraries
# with an additional build configuration (using installed deps and dav1d).
name: CI Unix Shared Installed
on: [push, pull_request]
permissions:
contents: read
# Cancel the workflow if a new one is triggered from the same PR, branch, or tag, except on main.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
build-shared-installed:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
include:
- runs-on: ubuntu-latest
compiler: gcc
gcc: 13
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set GCC & G++ compiler (on Linux)
if: runner.os == 'Linux'
run: echo "CC=gcc-${{matrix.gcc}}" >> $GITHUB_ENV && echo "CXX=g++-${{matrix.gcc}}" >> $GITHUB_ENV
- name: Disable libyuv on macOS
# TODO(yguyon): Install libyuv (not available with brew).
if: runner.os == 'macOS'
run: echo "CMAKE_AVIF_FLAGS=\"-DAVIF_LIBYUV=OFF\"" >> $GITHUB_ENV
- name: Cache external dependencies
id: cache-ext
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: ext
key: ${{ runner.os }}-shared-installed-${{ hashFiles('ext/*.cmd') }}
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@d06b37b47cfd043ec794ffa3e40e0b6b5858a7ec # v1.14.2
with:
cmake-version: '3.13.x'
- name: Print cmake version
run: cmake --version
- uses: seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # v4
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
echo "deb http://azure.archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install libaom-dev libdav1d-dev libyuv-dev imagemagick
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: brew install aom dav1d imagemagick
- name: Print ImageMagick version
run: convert --version
# `sudo apt-get install googletest libgtest-dev` leads to the following:
# "libgtest.a(gtest-all.cc.o): undefined reference to `std::__throw_bad_array_new_length()'"
# so build it locally instead.
- name: Build GoogleTest
if: steps.cache-ext.outputs.cache-hit != 'true'
working-directory: ./ext
run: bash -e googletest.cmd
- name: Prepare libavif (cmake)
run: >
mkdir build && cd build
cmake .. -G Ninja
-DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON
-DAVIF_CODEC_AOM=SYSTEM
-DAVIF_CODEC_AOM_DECODE=OFF -DAVIF_CODEC_AOM_ENCODE=ON
-DAVIF_CODEC_DAV1D=SYSTEM
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_LOCAL_GTEST=ON
-DAVIF_BUILD_GDK_PIXBUF=ON -DCMAKE_INSTALL_PREFIX=./install
-DAVIF_ENABLE_WERROR=ON ${{ env.CMAKE_AVIF_FLAGS }}
- name: Build libavif (ninja)
working-directory: ./build
run: ninja
- name: Run AVIF Tests
working-directory: ./build
run: ctest -j $(getconf _NPROCESSORS_ONLN) --output-on-failure
- name: Install AVIF
working-directory: ./build
run: ninja install
- name: Test installed cmake
working-directory: ./build
run: >
mkdir test && cd test
echo "cmake_minimum_required(VERSION 3.13)
project(FindPackageTest)
message(STATUS ${CMAKE_PREFIX_PATH})
find_package(libavif REQUIRED)
if(TARGET avif)
message(STATUS "\""avif found"\"")
else()
message(FATAL_ERROR "\""avif not found"\"")
endif()" >> CMakeLists.txt
cmake . -DCMAKE_PREFIX_PATH=../install
- name: Prepare libavif with [[nodiscard]] (cmake)
run: >
mkdir build_nodiscard && cd build_nodiscard
cmake .. -G Ninja
-DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON
-DAVIF_CODEC_AOM=SYSTEM
-DAVIF_CODEC_AOM_DECODE=OFF -DAVIF_CODEC_AOM_ENCODE=ON
-DAVIF_CODEC_DAV1D=SYSTEM
-DAVIF_ENABLE_WUNUSED_RESULT=ON -DAVIF_ENABLE_WERROR=ON
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_LOCAL_GTEST=ON
-DAVIF_BUILD_GDK_PIXBUF=ON ${{ env.CMAKE_AVIF_FLAGS }}
-DCMAKE_INSTALL_PREFIX=./install
- name: Build libavif with [[nodiscard]] (ninja)
working-directory: ./build_nodiscard
run: ninja