Thanks for reporting your issue. Please make sure these boxes are checked before submitting your issue - thank you!

- [x] I looked for a similar issue and couldn't find any.
- [x] I tried with the latest version of GPAC. Installers available at http://gpac.io/downloads/gpac-nightly-builds/
- [x] I give enough information for contributors to reproduce my issue (meaningful title, github labels, platform and compiler, command-line ...). I can share files anonymously with this dropbox: https://www.mediafire.com/filedrop/filedrop_hosted.php?drop=eec9e058a9486fe4e99c33021481d9e1826ca9dbc242a6cfaab0fe95da5e5d95


Hi, there.

There is a segmentation fault caused by invalid memory write in gf_list_add, list.c:655 in newest commit  6c7e0564303fa1690a744ad51a6b473564ea6d1a.  

Here is my environment, compiler info and gpac version:
~~~~
Distributor ID:	Ubuntu
Description:	20.04.6 LTS
Compiler: Clang 14.0.1

MP4Box - GPAC version 2.3-DEV-rev543-g6c7e05643-master
(c) 2000-2023 Telecom Paris distributed under LGPL v2.1+ - http://gpac.io

Please cite our work in your research:
	GPAC Filters: https://doi.org/10.1145/3339825.3394929
	GPAC: https://doi.org/10.1145/1291233.1291452

GPAC Configuration: --disable-shared
Features: GPAC_CONFIG_LINUX GPAC_64_BITS GPAC_HAS_IPV6 GPAC_HAS_SSL GPAC_HAS_SOCK_UN GPAC_MINIMAL_ODF GPAC_HAS_QJS GPAC_HAS_JPEG GPAC_HAS_PNG GPAC_HAS_JP2 GPAC_HAS_VORBIS GPAC_HAS_LINUX_DVB  GPAC_DISABLE_3D 
~~~~

To reproduce, run
~~~~
./MP4Box -dash 10000 poc
~~~~

POC:

[poc.zip](https://github.com/gpac/gpac/files/12782854/mp4box-seg-gf_list_add655.zip)
(unzip first)

Here is the trace reported by gdb:
~~~~
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff71c243b in gf_list_add (ptr=0x6e2fb0, item=item@entry=0x1413d9b8d0) at /benchmark/gpac/src/utils/list.c:655
#0  0x00007ffff71c243b in gf_list_add (ptr=0x6e2fb0, item=item@entry=0x1413d9b8d0) at  /benchmark/gpac/src/utils/list.c:655
#1  0x00007ffff743629a in senc_Parse (bs=0x6c64a0, trak=trak@entry=0x6bf940, traf=traf@entry=0x6adcc0, senc=0x6e1d40) at  /benchmark/gpac/src/isomedia/box_code_drm.c:1479
#2  0x00007ffff74f82a6 in MergeTrack (trak=trak@entry=0x6bf940, traf=traf@entry=0x6adcc0, moof_box=moof_box@entry=0x6e12c0, moof_offset=2004, compressed_diff=0, cumulated_offset=cumulated_offset@entry=0x7fffffff7178)
    at  /benchmark/gpac/src/isomedia/track.c:1177
#3  0x00007ffff747073c in MergeFragment (moof=0x6e12c0, mov=mov@entry=0x6c2840) at  /benchmark/gpac/src/isomedia/isom_intern.c:92
#4  0x00007ffff7473529 in gf_isom_parse_movie_boxes_internal (mov=0x6c2840, boxType=0x0, bytesMissing=0x6b2b90, progressive_mode=GF_TRUE) at  /benchmark/gpac/src/isomedia/isom_intern.c:736
#5  gf_isom_parse_movie_boxes (mov=mov@entry=0x6c2840, boxType=boxType@entry=0x0, bytesMissing=bytesMissing@entry=0x6b2b90, progressive_mode=progressive_mode@entry=GF_TRUE)
    at  /benchmark/gpac/src/isomedia/isom_intern.c:897
#6  0x00007ffff74779cc in gf_isom_open_progressive_ex (fileName=fileName@entry=0x6a3cf0 "tmp_crash", start_range=<optimized out>, end_range=<optimized out>, enable_frag_bounds=GF_FALSE, the_file=the_file@entry=0x6b2b70, 
    BytesMissing=BytesMissing@entry=0x6b2b90, outBoxType=0x0) at  /benchmark/gpac/src/isomedia/isom_read.c:475
#7  0x00007ffff747832b in gf_isom_open_progressive (fileName=0x7ffbf2a6a000 "", fileName@entry=0x6a3cf0 "tmp_crash", start_range=1170, end_range=4846240, enable_frag_bounds=(unknown: 0x6b123d4c), the_file=0x7ffbf2a6a000, 
    the_file@entry=0x6b2b70, BytesMissing=0x7ffbf2a6a000, BytesMissing@entry=0x6b2b90) at  /benchmark/gpac/src/isomedia/isom_read.c:501
#8  0x00007ffff79b3296 in isoffin_setup (filter=filter@entry=0x6d9250, read=read@entry=0x6b2af0, input_is_eos=input_is_eos@entry=GF_FALSE) at  /benchmark/gpac/src/filters/isoffin_read.c:144
#9  0x00007ffff79b1d02 in isoffin_configure_pid (filter=0x6d9250, pid=0x6a81c0, is_remove=GF_FALSE) at  /benchmark/gpac/src/filters/isoffin_read.c:477
#10 0x00007ffff7823ba1 in gf_filter_pid_configure (filter=filter@entry=0x6d9250, pid=0x6d70d0, ctype=ctype@entry=GF_PID_CONF_CONNECT) at  /benchmark/gpac/src/filter_core/filter_pid.c:876
#11 0x00007ffff7832c0d in gf_filter_pid_connect_task (task=0x6a54c0) at  /benchmark/gpac/src/filter_core/filter_pid.c:1230
#12 0x00007ffff7860d47 in gf_fs_thread_proc (sess_thread=sess_thread@entry=0x6a25d0) at  /benchmark/gpac/src/filter_core/filter_session.c:2070
#13 0x00007ffff785fb31 in gf_fs_run (fsess=0x6a2540) at  /benchmark/gpac/src/filter_core/filter_session.c:2370
#14 0x00007ffff7556514 in gf_dasher_process (dasher=0x6c1330) at  /benchmark/gpac/src/media_tools/dash_segmenter.c:1236
#15 0x000000000042d79d in do_dash () at  /benchmark/gpac/applications/mp4box/mp4box.c:4831
#16 0x0000000000422693 in mp4box_main (argc=4, argv=0x7fffffffe338) at  /benchmark/gpac/applications/mp4box/mp4box.c:6245
#17 0x00007ffff6f2c083 in __libc_start_main (main=0x42a530 <main>, argc=4, argv=0x7fffffffe338, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe328) at ../csu/libc-start.c:308
#18 0x0000000000410e5e in _start ()
~~~~


Segmentation fault caused by invalid memory write using mp4box in gf_list_add, list.c:655
This is a GitHub Issue
repo:gpac
owner:gpac
Title : Segmentation fault caused by invalid memory write using mp4box in gf_list_add, list.c:655
Issue date:

--- start body ---
Thanks for reporting your issue. Please make sure these boxes are checked before submitting your issue - thank you!

- [x] I looked for a similar issue and couldn't find any.
- [x] I tried with the latest version of GPAC. Installers available at http://gpac.io/downloads/gpac-nightly-builds/
- [x] I give enough information for contributors to reproduce my issue (meaningful title, github labels, platform and compiler, command-line ...). I can share files anonymously with this dropbox: https://www.mediafire.com/filedrop/filedrop_hosted.php?drop=eec9e058a9486fe4e99c33021481d9e1826ca9dbc242a6cfaab0fe95da5e5d95


Hi, there.

There is a segmentation fault caused by invalid memory write in gf_list_add, list.c:655 in newest commit  6c7e0564303fa1690a744ad51a6b473564ea6d1a.  

Here is my environment, compiler info and gpac version:
~~~~
Distributor ID:	Ubuntu
Description:	20.04.6 LTS
Compiler: Clang 14.0.1

MP4Box - GPAC version 2.3-DEV-rev543-g6c7e05643-master
(c) 2000-2023 Telecom Paris distributed under LGPL v2.1+ - http://gpac.io

Please cite our work in your research:
	GPAC Filters: https://doi.org/10.1145/3339825.3394929
	GPAC: https://doi.org/10.1145/1291233.1291452

GPAC Configuration: --disable-shared
Features: GPAC_CONFIG_LINUX GPAC_64_BITS GPAC_HAS_IPV6 GPAC_HAS_SSL GPAC_HAS_SOCK_UN GPAC_MINIMAL_ODF GPAC_HAS_QJS GPAC_HAS_JPEG GPAC_HAS_PNG GPAC_HAS_JP2 GPAC_HAS_VORBIS GPAC_HAS_LINUX_DVB  GPAC_DISABLE_3D 
~~~~

To reproduce, run
~~~~
./MP4Box -dash 10000 poc
~~~~

POC:

[poc.zip](https://github.com/gpac/gpac/files/12782854/mp4box-seg-gf_list_add655.zip)
(unzip first)

Here is the trace reported by gdb:
~~~~
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff71c243b in gf_list_add (ptr=0x6e2fb0, item=item@entry=0x1413d9b8d0) at /benchmark/gpac/src/utils/list.c:655
#0  0x00007ffff71c243b in gf_list_add (ptr=0x6e2fb0, item=item@entry=0x1413d9b8d0) at  /benchmark/gpac/src/utils/list.c:655
#1  0x00007ffff743629a in senc_Parse (bs=0x6c64a0, trak=trak@entry=0x6bf940, traf=traf@entry=0x6adcc0, senc=0x6e1d40) at  /benchmark/gpac/src/isomedia/box_code_drm.c:1479
#2  0x00007ffff74f82a6 in MergeTrack (trak=trak@entry=0x6bf940, traf=traf@entry=0x6adcc0, moof_box=moof_box@entry=0x6e12c0, moof_offset=2004, compressed_diff=0, cumulated_offset=cumulated_offset@entry=0x7fffffff7178)
    at  /benchmark/gpac/src/isomedia/track.c:1177
#3  0x00007ffff747073c in MergeFragment (moof=0x6e12c0, mov=mov@entry=0x6c2840) at  /benchmark/gpac/src/isomedia/isom_intern.c:92
#4  0x00007ffff7473529 in gf_isom_parse_movie_boxes_internal (mov=0x6c2840, boxType=0x0, bytesMissing=0x6b2b90, progressive_mode=GF_TRUE) at  /benchmark/gpac/src/isomedia/isom_intern.c:736
#5  gf_isom_parse_movie_boxes (mov=mov@entry=0x6c2840, boxType=boxType@entry=0x0, bytesMissing=bytesMissing@entry=0x6b2b90, progressive_mode=progressive_mode@entry=GF_TRUE)
    at  /benchmark/gpac/src/isomedia/isom_intern.c:897
#6  0x00007ffff74779cc in gf_isom_open_progressive_ex (fileName=fileName@entry=0x6a3cf0 "tmp_crash", start_range=<optimized out>, end_range=<optimized out>, enable_frag_bounds=GF_FALSE, the_file=the_file@entry=0x6b2b70, 
    BytesMissing=BytesMissing@entry=0x6b2b90, outBoxType=0x0) at  /benchmark/gpac/src/isomedia/isom_read.c:475
#7  0x00007ffff747832b in gf_isom_open_progressive (fileName=0x7ffbf2a6a000 "", fileName@entry=0x6a3cf0 "tmp_crash", start_range=1170, end_range=4846240, enable_frag_bounds=(unknown: 0x6b123d4c), the_file=0x7ffbf2a6a000, 
    the_file@entry=0x6b2b70, BytesMissing=0x7ffbf2a6a000, BytesMissing@entry=0x6b2b90) at  /benchmark/gpac/src/isomedia/isom_read.c:501
#8  0x00007ffff79b3296 in isoffin_setup (filter=filter@entry=0x6d9250, read=read@entry=0x6b2af0, input_is_eos=input_is_eos@entry=GF_FALSE) at  /benchmark/gpac/src/filters/isoffin_read.c:144
#9  0x00007ffff79b1d02 in isoffin_configure_pid (filter=0x6d9250, pid=0x6a81c0, is_remove=GF_FALSE) at  /benchmark/gpac/src/filters/isoffin_read.c:477
#10 0x00007ffff7823ba1 in gf_filter_pid_configure (filter=filter@entry=0x6d9250, pid=0x6d70d0, ctype=ctype@entry=GF_PID_CONF_CONNECT) at  /benchmark/gpac/src/filter_core/filter_pid.c:876
#11 0x00007ffff7832c0d in gf_filter_pid_connect_task (task=0x6a54c0) at  /benchmark/gpac/src/filter_core/filter_pid.c:1230
#12 0x00007ffff7860d47 in gf_fs_thread_proc (sess_thread=sess_thread@entry=0x6a25d0) at  /benchmark/gpac/src/filter_core/filter_session.c:2070
#13 0x00007ffff785fb31 in gf_fs_run (fsess=0x6a2540) at  /benchmark/gpac/src/filter_core/filter_session.c:2370
#14 0x00007ffff7556514 in gf_dasher_process (dasher=0x6c1330) at  /benchmark/gpac/src/media_tools/dash_segmenter.c:1236
#15 0x000000000042d79d in do_dash () at  /benchmark/gpac/applications/mp4box/mp4box.c:4831
#16 0x0000000000422693 in mp4box_main (argc=4, argv=0x7fffffffe338) at  /benchmark/gpac/applications/mp4box/mp4box.c:6245
#17 0x00007ffff6f2c083 in __libc_start_main (main=0x42a530 <main>, argc=4, argv=0x7fffffffe338, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe328) at ../csu/libc-start.c:308
#18 0x0000000000410e5e in _start ()
~~~~


--- end body ---
