Fuzz lou_translateString #95
This file contains 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: Fuzz lou_translateString | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 4 * * 1" | |
permissions: # added using https://github.com/step-security/secure-workflows | |
contents: read | |
jobs: | |
build: | |
name: Build with ${{ matrix.ucs }} | |
# Do not run this job on any forked repos | |
if: github.repository == 'liblouis/liblouis' | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
ucs: [ucs2] | |
# ucs4 | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 | |
with: | |
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Install dependencies | |
run: sudo apt-get update -qq && sudo apt-get install -y libyaml-dev texinfo texlive clang llvm | |
- name: Autogen | |
run: ./autogen.sh | |
- name: Configure | |
run: CC=clang CXX=clang++ | |
CFLAGS="-fsanitize=address,undefined -fstack-protector-strong -g -Og -fno-omit-frame-pointer" | |
CXXFLAGS="-fsanitize=address,undefined -fstack-protector-strong -g -Og -fno-omit-frame-pointer" | |
LDFLAGS="-fsanitize=address,undefined -lubsan" | |
./configure --with-fuzzer | |
if: matrix.ucs == 'ucs2' | |
- name: Configure with ucs4 | |
run: CC=clang CXX=clang++ | |
CFLAGS="-fsanitize=address,undefined -fstack-protector-strong -g -Og -fno-omit-frame-pointer" | |
CXXFLAGS="-fsanitize=address,undefined -fstack-protector-strong -g -Og -fno-omit-frame-pointer" | |
LDFLAGS="-fsanitize=address,undefined -lubsan" | |
./configure --with-fuzzer --enable-ucs4 | |
if: matrix.ucs == 'ucs4' | |
- name: Compile project | |
run: make -j | |
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: /home/runner/work/liblouis/liblouis | |
key: build-${{ matrix.ucs }}-${{ github.sha }} | |
run: | |
name: Run with ${{ matrix.ucs }} for ${{ matrix.table }} | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
ucs: [ucs2] | |
# ucs4 | |
table: [ afr-za-g1.ctb, afr-za-g2.ctb, akk.utb, akk-borger.utb, ar-ar-comp8.utb, ar-ar-g1.utb, ar-ar-g2.ctb, as-in-g1.utb, aw-in-g1.utb, ba.utb, be-in-g1.utb, bel.utb, bel-comp.utb, bel-detailed.utb, bg.ctb, bg.utb, bh.ctb, bo.ctb, boxes.ctb, br-in-g1.utb, ca-g1.ctb, chr-us-g1.ctb, ckb-g1.ctb, cop-eg-comp8.utb, cs-comp8.utb, cs-g1.ctb, cy-cy-g1.utb, cy-cy-g2.ctb, cuneiform-transliterated.utb, da-dk-g08_1993.ctb, da-dk-g08.ctb, da-dk-g16_1993.ctb, da-dk-g16.ctb, da-dk-g16-lit_1993.ctb, da-dk-g18_1993.ctb, da-dk-g18.ctb, da-dk-g26_1993.ctb, da-dk-g26.ctb, da-dk-g26l_1993.ctb, da-dk-g26-lit_1993.ctb, da-dk-g26l-lit_1993.ctb, da-dk-g28_1993.ctb, da-dk-g28.ctb, da-dk-g28l_1993.ctb, de-chess.ctb, de-comp6.utb, de-de-comp8.ctb, de-g0.utb, de-g0-detailed.utb, de-g1.ctb, de-g1-detailed.ctb, de-g2.ctb, de-g2-detailed.ctb, dra.ctb, el.ctb, en_CA.ctb, en-chess.ctb, en-gb-comp8.ctb, en-gb-g1.utb, en-GB-g2.ctb, en-in-g1.ctb, en-nabcc.utb, en-ueb-g1.ctb, en-ueb-g2.ctb, en-ueb-math.ctb, en-us-comp6.ctb, en-us-comp8.ctb, en-us-comp8-ext.utb, en-us-g1.ctb, en-us-g2.ctb, en-us-interline.ctb, en-us-mathtext.ctb, eo-g1.ctb, eo-g1-x-system.ctb, Es-Es-G0.utb, es-g1.ctb, es-g2.ctb, et.ctb, et-g0.utb, ethio-g1.ctb, fa-ir-comp8.ctb, fa-ir-g1.utb, fi-fi-8dot.ctb, fi.utb, fil-g2.ctb, fr-bfu-comp6.utb, fr-bfu-comp8.utb, fr-bfu-g2.ctb, ga-g1.utb, ga-g2.ctb, gd.ctb, gon.ctb, grc-international-en.utb, grc-international-en-composed.utb, grc-international-es.utb, gu-in-g1.utb, haw-us-g1.ctb, hbo.utb, he-IL.utb, he-IL-comp8.utb, hi-in-g1.utb, hr-comp8.utb, hr-g1.ctb, hu-hu-comp8.ctb, hu-hu-g1.ctb, hu-hu-g2.ctb, hy.ctb, IPA.utb, is.ctb, it-it-comp6.utb, it-it-comp8.utb, iu-ca-g1.ctb, ja-kantenji.utb, ja-kantenji-ucs2.utb, ka.utb, ka-in-g1.utb, kh-in-g1.utb, kk.utb, km-g1.utb, ko-2006-g1.ctb, ko-2006-g2.ctb, ko-g1.ctb, ko-g2.ctb, kok.ctb, kru.ctb, ks-in-g1.utb, lg-ug-g1.utb, lo-g1.utb, lt-6dot.utb, lt.ctb, Lv-Lv-g1.utb, mao-nz-g1.ctb, ml-in-g1.utb, mn-in-g1.utb, mn-MN-g1.utb, mn-MN-g2.ctb, mr-in-g1.utb, ms-my-g2.ctb, mt.ctb, mun.ctb, mwr.ctb, my-g1.utb, my-g2.ctb, ne.ctb, nl-comp8.utb, nl-NL-g0.utb, no-no-8dot-fallback-6dot-g0.utb, no-no-8dot.utb, no-no-comp8.ctb, no-no-g0.utb, no-no-g1.ctb, no-no-g2.ctb, no-no-g3.ctb, no-no-generic.ctb, np-in-g1.utb, nso-za-g1.utb, nso-za-g2.ctb, ny-mw.utb, or-in-g1.utb, pi.ctb, pl-pl-comp8.ctb, Pl-Pl-g1.utb, pt-pt-comp8.ctb, pt-pt-g1.utb, pt-pt-g2.ctb, pu-in-g1.utb, ro.ctb, ro-g0.utb, ru-compbrl.ctb, ru.ctb, ru-litbrl.ctb, ru-litbrl-detailed.utb, ru-ru-g1.ctb, rw-rw-g1.utb, sa-in-g1.utb, sah.utb, se-se.ctb, si-in-g1.utb, sin.utb, sk-g1.ctb, sk-sk-g1.utb, sk-sk.utb, sl-si-comp8.ctb, sl-si-g1.utb, sot-za-g1.ctb, sot-za-g2.ctb, sr-g1.ctb, sr-Cyrl.ctb, sv-1989.ctb, sv-1996.ctb, sv-g0.utb, sv-g1.ctb, sv-g2.ctb, sw-ke-g1-2.ctb, sw-ke-g1-3.ctb, sw-ke-g1-4.ctb, sw-ke-g1-5.ctb, sw-ke-g1.utb, sw-ke-g2.ctb, syc.utb, ta.ctb, ta-ta-g1.ctb, te-in-g1.utb, th-g0.utb, th-g1.utb, th-comp8-backward.utb, tr.ctb, tr-g1.ctb, tr-g2.ctb, tsn-za-g1.ctb, tsn-za-g2.ctb, tt.utb, uga.utb, uk.utb, uk-comp.utb, uk-detailed.utb, unicode-braille.utb, ur-pk-g1.utb, ur-pk-g2.ctb, uz-g1.utb, ve-za-g1.utb, ve-za-g2.ctb, vi-cb8.utb, vi-saigon-g1.ctb, vi-vn-g0.utb, vi-vn-g1.ctb, vi-vn-g2.ctb, xh-za-g1.utb, xh-za-g2.ctb, yi.utb, zh-chn.ctb, zhcn-cbs.ctb, zhcn-g1.ctb, zhcn-g2.ctb, zh-hk.ctb, zh-tw.ctb, zu-za-g1.utb, zu-za-g2.ctb, ] | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 | |
with: | |
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs | |
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: /home/runner/work/liblouis/liblouis | |
key: build-${{ matrix.ucs }}-${{ github.sha }} | |
- name: Fuzz function lou_translateString() | |
run: mkdir tests/fuzzing/CORPUS ; FUZZ_TABLE=tables/${{ matrix.table }} tests/fuzzing/fuzz_translate -seed=1234 -runs=100000 -max_len=10000 tests/fuzzing/CORPUS | |
- name: Store the crash POC | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 | |
with: | |
name: crash-${{ matrix.ucs }}-${{ matrix.table }}.1 | |
path: crash-* timeout-* | |
- name: Fuzz function lou_translateString() with language-specific input | |
run: cp tables/${{ matrix.table }} tests/fuzzing/CORPUS/ ; FUZZ_TABLE=tables/${{ matrix.table }} tests/fuzzing/fuzz_translate -seed=1234 -runs=30000 -max_len=10000 tests/fuzzing/CORPUS | |
- name: Store the crash POC | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 | |
with: | |
name: crash-${{ matrix.ucs }}-${{ matrix.table }}.2 | |
path: crash-* timeout-* |