[Y] I looked for a similar issue and couldn't find any.
[Y] I tried with the latest version of GPAC. Installers available at http://gpac.io/downloads/gpac-nightly-builds/
[Y] I give enough information for contributors to reproduce my issue

Description
There is a UndefinedBehaviorSanitizer in function gf_odf_hevc_cfg_write_bs

System info
Ubuntu 22.04.2 LTS
GPAC-2.2.1

Build command
CC=afl-clang-fast CXX=afl-clang-fast++ CFLAGS="-gdwarf-2 -g3 -O0 -fsanitize=undefined -fno-omit-frame-pointer" CXXFLAGS="-gdwarf-2 -g3 -O0 -fsanitize=undefined -fno-omit-frame-pointer" LDFLAGS="-fsanitize=undefined" ./configure && make

crash command
/usr/local/bin/MP4Box -dxml poc_file

poc_file:
[poc_file.zip](https://github.com/gpac/gpac/files/13238378/poc_file.zip)

Crash output:
UndefinedBehaviorSanitizer:DEADLYSIGNAL00)
==12508==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x000000000028 (pc 0x7fe115bc94c1 bp 0x556747ed1c50 sp 0x7ffc46ea8e80 T12508)
==12508==The signal is caused by a READ memory access.
==12508==Hint: address points to the zero page.
    #0 0x7fe115bc94c1 in gf_odf_hevc_cfg_write_bs (/usr/local/lib/libgpac.so.12+0x42a4c1) (BuildId: 6764f1c09e32020a66ba9eec9ce2e9686aa2bba1)
    #1 0x7fe115bc9a08 in gf_odf_hevc_cfg_write (/usr/local/lib/libgpac.so.12+0x42aa08) (BuildId: 6764f1c09e32020a66ba9eec9ce2e9686aa2bba1)
    #2 0x7fe1160c9f31 in isor_reader_check_config (/usr/local/lib/libgpac.so.12+0x92af31) (BuildId: 6764f1c09e32020a66ba9eec9ce2e9686aa2bba1)
    #3 0x7fe1160c34d8 in isoffin_process (/usr/local/lib/libgpac.so.12+0x9244d8) (BuildId: 6764f1c09e32020a66ba9eec9ce2e9686aa2bba1)
    #4 0x7fe115f8bb53 in gf_filter_process_task (/usr/local/lib/libgpac.so.12+0x7ecb53) (BuildId: 6764f1c09e32020a66ba9eec9ce2e9686aa2bba1)
    #5 0x7fe115f71a82 in gf_fs_thread_proc (/usr/local/lib/libgpac.so.12+0x7d2a82) (BuildId: 6764f1c09e32020a66ba9eec9ce2e9686aa2bba1)
    #6 0x7fe115f707f0 in gf_fs_run (/usr/local/lib/libgpac.so.12+0x7d17f0) (BuildId: 6764f1c09e32020a66ba9eec9ce2e9686aa2bba1)
    #7 0x7fe115ce4483 in gf_media_export (/usr/local/lib/libgpac.so.12+0x545483) (BuildId: 6764f1c09e32020a66ba9eec9ce2e9686aa2bba1)
    #8 0x55674751aaa2 in dump_isom_xml /root/fuzz/fuzz_gpac/gpac/applications/mp4box/filedump.c:2163:9
    #9 0x5567474ffd18 in mp4box_main /root/fuzz/fuzz_gpac/gpac/applications/mp4box/mp4box.c:6495:7
    #10 0x7fe115499d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #11 0x7fe115499e3f in __libc_start_main csu/../csu/libc-start.c:392:3
    #12 0x5567474c40f4 in _start (/usr/local/bin/MP4Box+0x1c0f4) (BuildId: 9b673f7d2fbc44cd30bc731fd2cbb5d4e49ad9ca)

UndefinedBehaviorSanitizer can not provide additional info.
SUMMARY: UndefinedBehaviorSanitizer: SEGV (/usr/local/lib/libgpac.so.12+0x42a4c1) (BuildId: 6764f1c09e32020a66ba9eec9ce2e9686aa2bba1) in gf_odf_hevc_cfg_write_bs
==12508==ABORTING

UndefinedBehaviorSanitizer in function gf_odf_hevc_cfg_write_bs
This is a GitHub Issue
repo:gpac
owner:gpac
Title : UndefinedBehaviorSanitizer in function gf_odf_hevc_cfg_write_bs
Issue date:

--- start body ---
[Y] I looked for a similar issue and couldn't find any.
[Y] I tried with the latest version of GPAC. Installers available at http://gpac.io/downloads/gpac-nightly-builds/
[Y] I give enough information for contributors to reproduce my issue

Description
There is a UndefinedBehaviorSanitizer in function gf_odf_hevc_cfg_write_bs

System info
Ubuntu 22.04.2 LTS
GPAC-2.2.1

Build command
CC=afl-clang-fast CXX=afl-clang-fast++ CFLAGS="-gdwarf-2 -g3 -O0 -fsanitize=undefined -fno-omit-frame-pointer" CXXFLAGS="-gdwarf-2 -g3 -O0 -fsanitize=undefined -fno-omit-frame-pointer" LDFLAGS="-fsanitize=undefined" ./configure && make

crash command
/usr/local/bin/MP4Box -dxml poc_file

poc_file:
[poc_file.zip](https://github.com/gpac/gpac/files/13238378/poc_file.zip)

Crash output:
UndefinedBehaviorSanitizer:DEADLYSIGNAL00)
==12508==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x000000000028 (pc 0x7fe115bc94c1 bp 0x556747ed1c50 sp 0x7ffc46ea8e80 T12508)
==12508==The signal is caused by a READ memory access.
==12508==Hint: address points to the zero page.
    #0 0x7fe115bc94c1 in gf_odf_hevc_cfg_write_bs (/usr/local/lib/libgpac.so.12+0x42a4c1) (BuildId: 6764f1c09e32020a66ba9eec9ce2e9686aa2bba1)
    #1 0x7fe115bc9a08 in gf_odf_hevc_cfg_write (/usr/local/lib/libgpac.so.12+0x42aa08) (BuildId: 6764f1c09e32020a66ba9eec9ce2e9686aa2bba1)
    #2 0x7fe1160c9f31 in isor_reader_check_config (/usr/local/lib/libgpac.so.12+0x92af31) (BuildId: 6764f1c09e32020a66ba9eec9ce2e9686aa2bba1)
    #3 0x7fe1160c34d8 in isoffin_process (/usr/local/lib/libgpac.so.12+0x9244d8) (BuildId: 6764f1c09e32020a66ba9eec9ce2e9686aa2bba1)
    #4 0x7fe115f8bb53 in gf_filter_process_task (/usr/local/lib/libgpac.so.12+0x7ecb53) (BuildId: 6764f1c09e32020a66ba9eec9ce2e9686aa2bba1)
    #5 0x7fe115f71a82 in gf_fs_thread_proc (/usr/local/lib/libgpac.so.12+0x7d2a82) (BuildId: 6764f1c09e32020a66ba9eec9ce2e9686aa2bba1)
    #6 0x7fe115f707f0 in gf_fs_run (/usr/local/lib/libgpac.so.12+0x7d17f0) (BuildId: 6764f1c09e32020a66ba9eec9ce2e9686aa2bba1)
    #7 0x7fe115ce4483 in gf_media_export (/usr/local/lib/libgpac.so.12+0x545483) (BuildId: 6764f1c09e32020a66ba9eec9ce2e9686aa2bba1)
    #8 0x55674751aaa2 in dump_isom_xml /root/fuzz/fuzz_gpac/gpac/applications/mp4box/filedump.c:2163:9
    #9 0x5567474ffd18 in mp4box_main /root/fuzz/fuzz_gpac/gpac/applications/mp4box/mp4box.c:6495:7
    #10 0x7fe115499d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #11 0x7fe115499e3f in __libc_start_main csu/../csu/libc-start.c:392:3
    #12 0x5567474c40f4 in _start (/usr/local/bin/MP4Box+0x1c0f4) (BuildId: 9b673f7d2fbc44cd30bc731fd2cbb5d4e49ad9ca)

UndefinedBehaviorSanitizer can not provide additional info.
SUMMARY: UndefinedBehaviorSanitizer: SEGV (/usr/local/lib/libgpac.so.12+0x42a4c1) (BuildId: 6764f1c09e32020a66ba9eec9ce2e9686aa2bba1) in gf_odf_hevc_cfg_write_bs
==12508==ABORTING

--- end body ---
