From 47226d34c17b5fb1b4f6a2c11535250d98a6ac94 Mon Sep 17 00:00:00 2001 From: Atom Raiff Date: Fri, 20 Nov 2026 20:32:58 -0500 Subject: [PATCH 1/2] Fix CI Python version on ubuntu-26.04 and WavWriter zero-byte write UB --- .github/workflows/build.yml | 4 ++-- src/util/WavWriter.h | 7 +++++-- tests/FatFsMock.cpp | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6bf0900a1..0eadc42a3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,9 +39,9 @@ jobs: with: release: '9-2019-q4' - name: Setup python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: '3.x' - name: Build Library run: make -j - name: Build Examples diff --git a/src/util/WavWriter.h b/src/util/WavWriter.h index ae52c11df..ac0718c81 100644 --- a/src/util/WavWriter.h +++ b/src/util/WavWriter.h @@ -176,8 +176,11 @@ class WavWriter if(remaining_size > max_bytes) remaining_size = max_bytes; - uint8_t *base = reinterpret_cast(transfer_buff); - f_write(&fp_, base + offset_bytes, remaining_size, &bw); + if(remaining_size > 0) + { + uint8_t *base = reinterpret_cast(transfer_buff); + f_write(&fp_, base + offset_bytes, remaining_size, &bw); + } } // 3. Finalize header and close diff --git a/tests/FatFsMock.cpp b/tests/FatFsMock.cpp index ea0c8ac10..82276145c 100644 --- a/tests/FatFsMock.cpp +++ b/tests/FatFsMock.cpp @@ -44,7 +44,8 @@ FRESULT f_write(FIL* fp, const void* buff, UINT btw, UINT* bw) if(state.file_data.size() < end_idx) state.file_data.resize(end_idx, 0); - std::memcpy(&state.file_data[start_idx], buff, static_cast(btw)); + if(btw > 0) + std::memcpy(&state.file_data[start_idx], buff, static_cast(btw)); state.cursor += btw; if(bw) *bw = btw; From 99f9498aab7e82901ff9ce210bd0efc8dd3fa39e Mon Sep 17 00:00:00 2001 From: Atom Raiff Date: Tue, 24 Nov 2026 10:14:32 -0500 Subject: [PATCH 2/2] specify python 3.14 for ci --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0eadc42a3..aa94771be 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,7 +41,7 @@ jobs: - name: Setup python uses: actions/setup-python@v5 with: - python-version: '3.x' + python-version: '3.14' - name: Build Library run: make -j - name: Build Examples