From 4410fe4ed934577adfe9be7612925a0575dab4a6 Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Wed, 5 Nov 2025 10:48:03 +0100 Subject: [PATCH 1/4] Fix problems reported by UBSAN in jbm_pcmdsp_apa_fx.c --- lib_com/options.h | 1 + lib_dec/jbm_pcmdsp_apa_fx.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 8171bdec9..8229838ca 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -95,6 +95,7 @@ #define FIX_2015_PREMPH_SAT_ALT /* VA: saturation can happen during preemphasis filtering due to a too aggressive scaling factor, allows preemphis to get 1 more bit headroom */ #define FIX_2178_FL_TO_FX_WITH_OBJ_EDIT_FILE_INTERFACE /* Nokia: Fixes float to fx conversion in decoder app with object edit file interface */ +#define FIX_2173_UBSAN_IN_JBM_PCMDSP_APA /* ################### End FIXES switches ########################### */ /* #################### Start BASOP porting switches ############################ */ diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c index 37e3f51a7..b2418a9fc 100644 --- a/lib_dec/jbm_pcmdsp_apa_fx.c +++ b/lib_dec/jbm_pcmdsp_apa_fx.c @@ -127,7 +127,11 @@ struct apa_state_t UWord16 qualityred; /* quality reduction threshold */ UWord16 qualityrise; /* quality rising for adaptive quality thresholds */ +#ifdef FIX_2173_UBSAN_IN_JBM_PCMDSP_APA + Word16 last_pitch; /* last pitch/sync position */ +#else UWord16 last_pitch; /* last pitch/sync position */ +#endif UWord16 bad_frame_count; /* # frames before quality threshold is lowered */ UWord16 good_frame_count; /* # scaled frames */ @@ -1392,7 +1396,11 @@ static Word8 logarithmic_search_fx( const apa_state_t *ps, DO { +#ifdef FIX_2173_UBSAN_IN_JBM_PCMDSP_APA + coeff_max = INT32_MIN; /* will always be overwritten with result of first correlation */ +#else coeff_max = 0x80000000; /* will always be overwritten with result of first correlation */ +#endif move32(); FOR( i = s_start; i < s_start + inlen; i += css * ps->num_channels ) -- GitLab From fbe9f9c4750745c43df11ac60f13ec841ce5452d Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Wed, 5 Nov 2025 11:20:05 +0100 Subject: [PATCH 2/4] Fix formatting --- lib_dec/jbm_pcmdsp_apa_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c index b2418a9fc..bc9ef573f 100644 --- a/lib_dec/jbm_pcmdsp_apa_fx.c +++ b/lib_dec/jbm_pcmdsp_apa_fx.c @@ -128,9 +128,9 @@ struct apa_state_t UWord16 qualityrise; /* quality rising for adaptive quality thresholds */ #ifdef FIX_2173_UBSAN_IN_JBM_PCMDSP_APA - Word16 last_pitch; /* last pitch/sync position */ + Word16 last_pitch; /* last pitch/sync position */ #else - UWord16 last_pitch; /* last pitch/sync position */ + UWord16 last_pitch; /* last pitch/sync position */ #endif UWord16 bad_frame_count; /* # frames before quality threshold is lowered */ UWord16 good_frame_count; /* # scaled frames */ -- GitLab From 001f89affc8c079a980df6c74eeeddce4143d40d Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Wed, 5 Nov 2025 11:03:09 +0100 Subject: [PATCH 3/4] [revert-this] temporarily add USAN job to MR pipeline --- .gitlab-ci.yml | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 93d77386f..a6536e775 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,3 +9,58 @@ include: file: main-basop.yml - local: .gitlab-ci/variables.yml - local: .gitlab-ci/rules-basis.yml + +.tmp-ivas-pytest-sanitizers-anchor: &tmp-ivas-pytest-sanitizers-anchor + extends: + - .job-linux + stage: test + needs: ["build-codec-linux-make"] + script: + - !reference [ .job-linux, before_script ] + + - bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/print-common-info.sh + - bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/update-scripts-repo.sh + - bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/copy-ltv-files-to-testv-dir.sh + - python3 ci/remove_unsupported_testcases.py $PRM_FILES + + - set -euxo pipefail + - make_args="CLANG=$CLANG_NUM" + - if [[ $CLANG_NUM == 3 ]]; then + - export UBSAN_OPTIONS="suppressions=scripts/ubsan_basop.supp,report_error_type=1,print_stacktrace=1" + - python3 scripts/basop_create_ignorelist_for_ubsan.py + - make_args="$make_args IGNORELIST=1" + - fi + - make clean + - make -j $make_args >> /dev/null + - testcase_timeout_arg="--testcase_timeout $TESTCASE_TIMEOUT_LTV_SANITIZERS" + # disable per-testcase timeout for msan to evaluate what is going on that it takes so long + - if [[ $CLANG_NUM = 1 ]]; then + - testcase_timeout_arg="" + - fi + + # NOTE: here we do not use the "DUT_..CODER_PATH" variables because we do not build via a script, but directly from the make file (which is done because of the "make_args" - no way to inject that into build-binaries.sh) + - python3 -m pytest $TEST_SUITE -v --tb=no --update_ref 1 --html=report.html --self-contained-html --junit-xml=report-junit.xml $testcase_timeout_arg --ref_encoder_path IVAS_cod --ref_decoder_path IVAS_dec + artifacts: + name: "$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA--results" + when: always + expire_in: "2 weeks" + paths: + - report-junit.xml + - report.html + reports: + junit: + - report-junit.xml + +tmp-ivas-pytest-usan: + extends: + - .test-job-linux + tags: + - ivas-basop-linux-fast + resource_group: basop-long-sanitizers + rules: + timeout: "6 hours" + before_script: + - CLANG_NUM=3 + - TEST_SUITE=$LONG_TEST_SUITE_NO_RENDERER + <<: *tmp-ivas-pytest-sanitizers-anchor + -- GitLab From 95ab3f4bb3396a04eb7d00afb2d12c96b0cdef8f Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Wed, 5 Nov 2025 14:08:57 +0100 Subject: [PATCH 4/4] Revert "[revert-this] temporarily add USAN job to MR pipeline" This reverts commit 001f89affc8c079a980df6c74eeeddce4143d40d. --- .gitlab-ci.yml | 55 -------------------------------------------------- 1 file changed, 55 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a6536e775..93d77386f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,58 +9,3 @@ include: file: main-basop.yml - local: .gitlab-ci/variables.yml - local: .gitlab-ci/rules-basis.yml - -.tmp-ivas-pytest-sanitizers-anchor: &tmp-ivas-pytest-sanitizers-anchor - extends: - - .job-linux - stage: test - needs: ["build-codec-linux-make"] - script: - - !reference [ .job-linux, before_script ] - - - bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/print-common-info.sh - - bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/update-scripts-repo.sh - - bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/copy-ltv-files-to-testv-dir.sh - - python3 ci/remove_unsupported_testcases.py $PRM_FILES - - - set -euxo pipefail - - make_args="CLANG=$CLANG_NUM" - - if [[ $CLANG_NUM == 3 ]]; then - - export UBSAN_OPTIONS="suppressions=scripts/ubsan_basop.supp,report_error_type=1,print_stacktrace=1" - - python3 scripts/basop_create_ignorelist_for_ubsan.py - - make_args="$make_args IGNORELIST=1" - - fi - - make clean - - make -j $make_args >> /dev/null - - testcase_timeout_arg="--testcase_timeout $TESTCASE_TIMEOUT_LTV_SANITIZERS" - # disable per-testcase timeout for msan to evaluate what is going on that it takes so long - - if [[ $CLANG_NUM = 1 ]]; then - - testcase_timeout_arg="" - - fi - - # NOTE: here we do not use the "DUT_..CODER_PATH" variables because we do not build via a script, but directly from the make file (which is done because of the "make_args" - no way to inject that into build-binaries.sh) - - python3 -m pytest $TEST_SUITE -v --tb=no --update_ref 1 --html=report.html --self-contained-html --junit-xml=report-junit.xml $testcase_timeout_arg --ref_encoder_path IVAS_cod --ref_decoder_path IVAS_dec - artifacts: - name: "$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA--results" - when: always - expire_in: "2 weeks" - paths: - - report-junit.xml - - report.html - reports: - junit: - - report-junit.xml - -tmp-ivas-pytest-usan: - extends: - - .test-job-linux - tags: - - ivas-basop-linux-fast - resource_group: basop-long-sanitizers - rules: - timeout: "6 hours" - before_script: - - CLANG_NUM=3 - - TEST_SUITE=$LONG_TEST_SUITE_NO_RENDERER - <<: *tmp-ivas-pytest-sanitizers-anchor - -- GitLab