Skip to content

Fix crash when decoding extended literals with a large index #2070

Fix crash when decoding extended literals with a large index

Fix crash when decoding extended literals with a large index #2070

Workflow file for this run

#
# Copyright 2022 Fred Dushin <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
#
name: esp32-mkimage
on:
push:
paths:
- '.github/workflows/esp32-mkimage.yaml'
- 'CMakeLists.txt'
- 'libs/**'
- 'src/platforms/esp32/**'
- 'src/platforms/esp32/**/**'
- 'src/libAtomVM/**'
- 'tools/packbeam/**'
pull_request:
paths:
- '.github/workflows/esp32-mkimage.yaml'
- 'src/platforms/esp32/**'
- 'src/platforms/esp32/**/**'
- 'src/libAtomVM/**'
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
esp32-release:
runs-on: ubuntu-22.04
container: espressif/idf:v${{ matrix.idf-version }}
strategy:
matrix:
idf-version: ["5.3.1"]
cc: ["clang-14"]
cxx: ["clang++-14"]
cflags: ["-O3"]
otp: ["27"]
elixir_version: ["1.17"]
compiler_pkgs: ["clang-14"]
soc: ["esp32", "esp32c2", "esp32c3", "esp32s2", "esp32s3", "esp32c6", "esp32h2"]
flavor: ["", "-elixir"]
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
CFLAGS: ${{ matrix.cflags }}
CXXFLAGS: ${{ matrix.cflags }}
ImageOS: "ubuntu22"
steps:
- name: Checkout repo
uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir_version }}
hexpm-mirrors: |
https://builds.hex.pm
https://repo.hex.pm
https://cdn.jsdelivr.net/hex
- name: "APT update"
run: apt update -y
- name: "Install deps"
run: DEBIAN_FRONTEND=noninteractive apt install -y ${{ matrix.compiler_pkgs}} git cmake gperf zlib1g-dev
# needed for generating AtomVM version when running in a docker container
- name: "Configure Git"
run: |
git config --global --add safe.directory /__w/AtomVM/AtomVM
echo -n "git rev-parse: "
git rev-parse --short HEAD
# Builder info
- name: "System info"
run: |
echo "**uname:**"
uname -a
echo "**libc version:**"
ldd --version
echo "**C Compiler version:**"
$CC --version
$CXX --version
echo "**Linker version:**"
ld --version
echo "**CMake version:**"
cmake --version
echo "**OTP version:**"
cat $(dirname $(which erlc))/../releases/RELEASES || true
- name: "Build: create build dir"
run: mkdir build
- name: "Build: run cmake"
working-directory: build
run: |
cmake ..
# git clone will use more recent timestamps than cached beam files
# touch them so we can benefit from the cache and avoid costly beam file rebuild.
find . -name '*.beam' -exec touch {} \;
- name: "Build erlang and Elixir libs"
working-directory: build/libs
run: |
make
- name: "Use release defaults"
if: startsWith(github.ref, 'refs/tags/')
shell: bash
working-directory: ./src/platforms/esp32/
run: |
cp sdkconfig.release-defaults sdkconfig.defaults
- name: "Build ${{ matrix.soc }}${{ matrix.flavor }} with idf.py"
shell: bash
working-directory: ./src/platforms/esp32/
run: |
rm -rf build
. $IDF_PATH/export.sh
if [ ! -z "${{ matrix.flavor }}" ]
then
mv partitions${{ matrix.flavor }}.csv partitions.csv
fi
idf.py set-target ${{ matrix.soc }}
idf.py reconfigure
idf.py build
- name: "Create a ${{ matrix.soc }}${{ matrix.flavor }} image"
working-directory: ./src/platforms/esp32/build
run: |
if [ -z "${{ matrix.flavor }}" ]
then
./mkimage.sh
else
FLAVOR_SUFFIX=$(echo "${{ matrix.flavor }}" | sed 's/-//g')
BOOT_FILE="build/libs/esp32boot/${FLAVOR_SUFFIX}_esp32boot.avm"
./mkimage.sh --boot="$BOOT_FILE"
mv atomvm-${{ matrix.soc }}.img atomvm-${{ matrix.soc }}${{ matrix.flavor }}.img
fi
ls -l *.img
- name: "Upload ${{ matrix.soc }} artifacts"
uses: actions/upload-artifact@v4
with:
name: atomvm-${{ matrix.soc }}${{ matrix.flavor }}-image
path: ./src/platforms/esp32/build/atomvm-${{ matrix.soc }}${{ matrix.flavor }}.img
if-no-files-found: error
- name: "Rename and write sha256sum"
if: startsWith(github.ref, 'refs/tags/')
shell: bash
working-directory: src/platforms/esp32/build
run: |
ATOMVM_IMG="AtomVM-${{ matrix.soc }}${{ matrix.flavor }}-${{ github.ref_name }}.img"
mv atomvm-${{ matrix.soc }}${{ matrix.flavor }}.img "${ATOMVM_IMG}"
sha256sum "${ATOMVM_IMG}" > "${ATOMVM_IMG}.sha256"
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
fail_on_unmatched_files: true
files: |
src/platforms/esp32/build/AtomVM-${{ matrix.soc }}${{ matrix.flavor }}-${{ github.ref_name }}.img
src/platforms/esp32/build/AtomVM-${{ matrix.soc }}${{ matrix.flavor }}-${{ github.ref_name }}.img.sha256