| 1 | name: fuzzing |
| 2 | |
| 3 | on: |
| 4 | workflow_dispatch: |
| 5 | schedule: |
| 6 | - cron: "0 4 * * 1" |
| 7 | |
| 8 | jobs: |
| 9 | build: |
| 10 | runs-on: ubuntu-latest |
| 11 | name: Build synth_espeak on ${{ matrix.arch }} |
| 12 | # Do not run this job on any forked repos |
| 13 | if: github.repository == 'espeak-ng/espeak-ng' |
| 14 | strategy: |
| 15 | fail-fast: false |
| 16 | matrix: |
| 17 | arch: [x86-32, x86-64] |
| 18 | include: |
| 19 | - arch: x86-32 |
| 20 | archdeps: "gcc-multilib g++-multilib libpcaudio-dev:i386 libsonic-dev:i386 libc6-dbg:i386" |
| 21 | archconfig: "--host=i686-linux-gnu" |
| 22 | archconfigflags: "-m32" |
| 23 | |
| 24 | - arch: x86-64 |
| 25 | archdeps: "" |
| 26 | archconfigflags: '' |
| 27 | steps: |
| 28 | - uses: actions/checkout@v4 |
| 29 | - name: enable 32bit architecture |
| 30 | run: sudo dpkg --add-architecture i386 |
| 31 | if: matrix.arch == 'x86-32' |
| 32 | - name: dependencies |
| 33 | run: sudo apt-get update && sudo apt-get install libpcaudio-dev libsonic-dev ronn kramdown clang llvm ${{ matrix.archdeps }} |
| 34 | - name: autoconf |
| 35 | run: ./autogen.sh ; chmod -x INSTALL m4/*.m4 |
| 36 | - name: configure |
| 37 | run: CC="clang ${{ matrix.archconfigflags }}" CXX="clang++ ${{ matrix.archconfigflags }}" |
| 38 | CFLAGS="-fsanitize=address,undefined -fstack-protector-strong -g -Og -fno-omit-frame-pointer" |
| 39 | CXXFLAGS="${{ matrix.archconfigflags }} -fsanitize=address,undefined -fstack-protector-strong -g -Og -fno-omit-frame-pointer" |
| 40 | LDFLAGS="-fsanitize=address,undefined -lubsan" |
| 41 | ./configure ${{ matrix.archconfig }} --with-libfuzzer |
| 42 | - name: Store the fuzzer config |
| 43 | if: ${{ failure() }} |
| 44 | uses: actions/upload-artifact@v4 |
| 45 | with: |
| 46 | name: config-${{ matrix.arch }}-${{ matrix.lang }}.log |
| 47 | path: config.log |
| 48 | - name: make |
| 49 | run: make -j |
| 50 | - uses: actions/cache@v4 |
| 51 | with: |
| 52 | path: /home/runner/work/espeak-ng/espeak-ng |
| 53 | key: build-${{ matrix.arch }}-${{ github.sha }} |
| 54 | |
| 55 | fuzzing: |
| 56 | needs: build |
| 57 | runs-on: ubuntu-latest |
| 58 | name: Fuzz synth_espeak on ${{ matrix.arch }} for ${{ matrix.lang }} |
| 59 | strategy: |
| 60 | fail-fast: false |
| 61 | matrix: |
| 62 | arch: [x86-32, x86-64] |
| 63 | lang: [af, am, an, ar, as, az, ba, be, bg, bn, bpy, bs, ca, chr, cmn, cs, cv, cy, da, de, el, en, eo, es, et, eu, fa, fi, fr, ga, gd, gn, grc, gu, hak, haw, he, hi, hr, ht, hu, hy, hyw, ia, id, io, is, it, ja, jbo, ka, kk, kl, kn, ko, kok, ku, ky, la, lb, lfn, lt, ltg, lv, mi, mk, ml, mr, ms, mt, mto, my, nb, nci, ne, nl, nog, om, or, pa, pap, piqd, pl, pt, pt-BR, py, qdb, qu, quc, qya, ro, ru, ru-LV, sd, shn, si, sjn, sk, sl, smj, sq, sr, sv, sw, ta, te, th, tk, tn, tr, tt, ug, uk, ur, uz, vi, yue] |
| 64 | include: |
| 65 | - arch: x86-32 |
| 66 | archdeps: "libpcaudio0:i386 libsonic0:i386 libubsan1:i386 libc6-dbg:i386" |
| 67 | |
| 68 | - arch: x86-64 |
| 69 | archdeps: "" |
| 70 | steps: |
| 71 | - uses: actions/cache@v4 |
| 72 | with: |
| 73 | path: /home/runner/work/espeak-ng/espeak-ng |
| 74 | key: build-${{ matrix.arch }}-${{ github.sha }} |
| 75 | - name: enable 32bit architecture |
| 76 | run: sudo dpkg --add-architecture i386 |
| 77 | if: matrix.arch == 'x86-32' |
| 78 | - name: dependencies |
| 79 | run: sudo apt-get update && sudo apt-get install libpcaudio0 libsonic0 libubsan1 ${{ matrix.archdeps }} |
| 80 | - name: Fuzz function synth_espeak() |
| 81 | run: mkdir tests/fuzzing/CORPUS_DIR ; FUZZ_VOICE=${{ matrix.lang }} tests/fuzzing/synth_fuzzer.test -seed=1 -runs=10000 -max_len=4096 tests/fuzzing/CORPUS_DIR |
| 82 | - name: Store the crash POC |
| 83 | if: ${{ failure() }} |
| 84 | uses: actions/upload-artifact@v4 |
| 85 | with: |
| 86 | name: crash-${{ matrix.arch }}-${{ matrix.lang }}.1 |
| 87 | path: crash-* timeout-* |
| 88 | - name: Fuzz function synth_espeak() with language-specific input |
| 89 | run: cp dictsource/${{ matrix.lang }}_* tests/fuzzing/CORPUS_DIR/ || true ; FUZZ_VOICE=${{ matrix.lang }} tests/fuzzing/synth_fuzzer.test -seed=1 -runs=10000 -max_len=4096 tests/fuzzing/CORPUS_DIR |
| 90 | - name: Store the crash POC |
| 91 | if: ${{ failure() }} |
| 92 | uses: actions/upload-artifact@v4 |
| 93 | with: |
| 94 | name: crash-${{ matrix.arch }}-${{ matrix.lang }}.2 |
| 95 | path: crash-* timeout-* |