Poc address: https://github.com/Janette88/test_pocs/blob/main/hbo_2429

MP4Box -dash 1000 /home/fuzz/crashes/hbo_2429

```
Description

heap-buffer-overflow in gf_m2ts_get_adaptation_field at media_tools/mpegts.c:2429.
Version

git log
commit 7edc40feef23efd8c9948292d269eae76fa475af (HEAD -> master, origin/master, origin/HEAD)
Author: jeanlf <jeanlf@gpac.io>
Date:   Thu Oct 12 16:58:53 2023 +0200

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

Proof of Concept


./bin/gcc/MP4Box -dash 1000 /home/fuzz/crashes/hbo_2429
[MPEG-2 TS] TS Packet 2 is scrambled - not supported
[MPEG-2 TS] TS Packet 3 is scrambled - not supported
[MPEG-2 TS] TS Packet 4 is scrambled - not supported
[MPEG-2 TS] TS Packet 5 is scrambled - not supported
[MPEG-2 TS] TS Packet 6 is scrambled - not supported
[MPEG-2 TS] TS Packet 7 is scrambled - not supported
[MPEG-2 TS] TS Packet 8 is scrambled - not supported
[MPEG-2 TS] TS Packet 9 is scrambled - not supported
[MPEG-2 TS] TS Packet 10 is scrambled - not supported
[MPEG-2 TS] TS Packet 11 is scrambled - not supported
[MPEG-2 TS] TS Packet 12 is scrambled - not supported
[MPEG-2 TS] TS Packet 13 is scrambled - not supported
[MPEG-2 TS] TS Packet 14 is scrambled - not supported
[MPEG-2 TS] TS Packet 15 is scrambled - not supported
[MPEG-2 TS] TS Packet 16 is scrambled - not supported
[MPEG-2 TS] TS Packet 17 is scrambled - not supported
[MPEG-2 TS] TS Packet 18 is scrambled - not supported
[MPEG-2 TS] TS Packet 19 is scrambled - not supported
[MPEG-2 TS] TS Packet 20 is scrambled - not supported
[MPEG-2 TS] TS Packet 21 is scrambled - not supported
[MPEG-2 TS] TS Packet 22 is scrambled - not supported
[MPEG-2 TS] TS Packet 23 is scrambled - not supported
[MPEG-2 TS] TS Packet 24 is scrambled - not supported
[MPEG-2 TS] TS Packet 25 is scrambled - not supported
[MPEG-2 TS] TS Packet 26 is scrambled - not supported
[MPEG-2 TS] TS Packet 27 is scrambled - not supported
[MPEG-2 TS] TS Packet 28 is scrambled - not supported
[MPEG-2 TS] TS Packet 29 is scrambled - not supported
[MPEG-2 TS] TS Packet 30 is scrambled - not supported
[MPEG-2 TS] TS Packet 31 is scrambled - not supported
[MPEG-2 TS] TS Packet 32 is scrambled - not supported
[MPEG-2 TS] TS Packet 33 is scrambled - not supported
[MPEG-2 TS] TS Packet 34 is scrambled - not supported
[MPEG-2 TS] TS Packet 35 is scrambled - not supported
[MPEG-2 TS] TS Packet 36 is scrambled - not supported
[MPEG-2 TS] TS Packet 37 does not start with sync marker
[MPEG-2 TS] TS Packet 38 does not start with sync marker
[MPEG-2 TS] PID 0: Bad Adaptation Descriptor found (tag 0) size is 135 but only 41 bytes available
[MPEG-2 TS] PID 3703: Bad Adaptation Descriptor found (tag 0) size is 0 but only 254 bytes available
=================================================================
==59092==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x625000018da4 at pc 0x7ffff4459f03 bp 0x7ffffffec2d0 sp 0x7ffffffec2c0
READ of size 1 at 0x625000018da4 thread T0
    #0 0x7ffff4459f02 in gf_m2ts_get_adaptation_field media_tools/mpegts.c:2429
    #1 0x7ffff446929d in gf_m2ts_process_packet media_tools/mpegts.c:2565
    #2 0x7ffff446c1e9 in gf_m2ts_process_data media_tools/mpegts.c:2842
    #3 0x7ffff4bc2616 in m2tsdmx_configure_pid filters/dmx_m2ts.c:1173
    #4 0x7ffff49e9b9e in gf_filter_pid_configure filter_core/filter_pid.c:876
    #5 0x7ffff49f256e in gf_filter_pid_connect_task filter_core/filter_pid.c:1230
    #6 0x7ffff4a2ab11 in gf_fs_thread_proc filter_core/filter_session.c:2105
    #7 0x7ffff4a2f8b6 in gf_fs_run filter_core/filter_session.c:2405
    #8 0x7ffff43bc0bd in gf_dasher_process media_tools/dash_segmenter.c:1236
    #9 0x555555621d26 in do_dash /home/fuzz/gpac/applications/mp4box/mp4box.c:4831
    #10 0x555555621d26 in mp4box_main /home/fuzz/gpac/applications/mp4box/mp4box.c:6245
    #11 0x7ffff164c082 in __libc_start_main ../csu/libc-start.c:308
    #12 0x5555555fa05d in _start (/home/fuzz/gpac/bin/gcc/MP4Box+0xa605d)

0x625000018da4 is located 0 bytes to the right of 9380-byte region [0x625000016900,0x625000018da4)
allocated by thread T0 here:
    #0 0x7ffff7690c3e in __interceptor_realloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:163
    #1 0x7ffff446c57b in gf_m2ts_process_data media_tools/mpegts.c:2793
    #2 0x7ffff4bc2616 in m2tsdmx_configure_pid filters/dmx_m2ts.c:1173
    #3 0x7ffff49e9b9e in gf_filter_pid_configure filter_core/filter_pid.c:876
    #4 0x7ffff49f256e in gf_filter_pid_connect_task filter_core/filter_pid.c:1230
    #5 0x7ffff4a2ab11 in gf_fs_thread_proc filter_core/filter_session.c:2105
    #6 0x7ffff4a2f8b6 in gf_fs_run filter_core/filter_session.c:2405
    #7 0x7ffff43bc0bd in gf_dasher_process media_tools/dash_segmenter.c:1236
    #8 0x555555621d26 in do_dash /home/fuzz/gpac/applications/mp4box/mp4box.c:4831
    #9 0x555555621d26 in mp4box_main /home/fuzz/gpac/applications/mp4box/mp4box.c:6245
    #10 0x7ffff164c082 in __libc_start_main ../csu/libc-start.c:308

SUMMARY: AddressSanitizer: heap-buffer-overflow media_tools/mpegts.c:2429 in gf_m2ts_get_adaptation_field
Shadow bytes around the buggy address:
  0x0c4a7fffb160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4a7fffb170: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4a7fffb180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4a7fffb190: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4a7fffb1a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c4a7fffb1b0: 00 00 00 00[04]fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a7fffb1c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a7fffb1d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a7fffb1e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a7fffb1f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a7fffb200: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==59092==ABORTING


Impact

This vulnerability is capable of crashing software, modify memory, and possible remote execution.
Occurrences

mpegts.c L2429

```
heap-buffer-overflow in gf_m2ts_get_adaptation_field
This is a GitHub Issue
repo:gpac
owner:gpac
Title : heap-buffer-overflow in gf_m2ts_get_adaptation_field
Issue date:

--- start body ---
Poc address: https://github.com/Janette88/test_pocs/blob/main/hbo_2429

MP4Box -dash 1000 /home/fuzz/crashes/hbo_2429

```
Description

heap-buffer-overflow in gf_m2ts_get_adaptation_field at media_tools/mpegts.c:2429.
Version

git log
commit 7edc40feef23efd8c9948292d269eae76fa475af (HEAD -> master, origin/master, origin/HEAD)
Author: jeanlf <jeanlf@gpac.io>
Date:   Thu Oct 12 16:58:53 2023 +0200

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

Proof of Concept


./bin/gcc/MP4Box -dash 1000 /home/fuzz/crashes/hbo_2429
[MPEG-2 TS] TS Packet 2 is scrambled - not supported
[MPEG-2 TS] TS Packet 3 is scrambled - not supported
[MPEG-2 TS] TS Packet 4 is scrambled - not supported
[MPEG-2 TS] TS Packet 5 is scrambled - not supported
[MPEG-2 TS] TS Packet 6 is scrambled - not supported
[MPEG-2 TS] TS Packet 7 is scrambled - not supported
[MPEG-2 TS] TS Packet 8 is scrambled - not supported
[MPEG-2 TS] TS Packet 9 is scrambled - not supported
[MPEG-2 TS] TS Packet 10 is scrambled - not supported
[MPEG-2 TS] TS Packet 11 is scrambled - not supported
[MPEG-2 TS] TS Packet 12 is scrambled - not supported
[MPEG-2 TS] TS Packet 13 is scrambled - not supported
[MPEG-2 TS] TS Packet 14 is scrambled - not supported
[MPEG-2 TS] TS Packet 15 is scrambled - not supported
[MPEG-2 TS] TS Packet 16 is scrambled - not supported
[MPEG-2 TS] TS Packet 17 is scrambled - not supported
[MPEG-2 TS] TS Packet 18 is scrambled - not supported
[MPEG-2 TS] TS Packet 19 is scrambled - not supported
[MPEG-2 TS] TS Packet 20 is scrambled - not supported
[MPEG-2 TS] TS Packet 21 is scrambled - not supported
[MPEG-2 TS] TS Packet 22 is scrambled - not supported
[MPEG-2 TS] TS Packet 23 is scrambled - not supported
[MPEG-2 TS] TS Packet 24 is scrambled - not supported
[MPEG-2 TS] TS Packet 25 is scrambled - not supported
[MPEG-2 TS] TS Packet 26 is scrambled - not supported
[MPEG-2 TS] TS Packet 27 is scrambled - not supported
[MPEG-2 TS] TS Packet 28 is scrambled - not supported
[MPEG-2 TS] TS Packet 29 is scrambled - not supported
[MPEG-2 TS] TS Packet 30 is scrambled - not supported
[MPEG-2 TS] TS Packet 31 is scrambled - not supported
[MPEG-2 TS] TS Packet 32 is scrambled - not supported
[MPEG-2 TS] TS Packet 33 is scrambled - not supported
[MPEG-2 TS] TS Packet 34 is scrambled - not supported
[MPEG-2 TS] TS Packet 35 is scrambled - not supported
[MPEG-2 TS] TS Packet 36 is scrambled - not supported
[MPEG-2 TS] TS Packet 37 does not start with sync marker
[MPEG-2 TS] TS Packet 38 does not start with sync marker
[MPEG-2 TS] PID 0: Bad Adaptation Descriptor found (tag 0) size is 135 but only 41 bytes available
[MPEG-2 TS] PID 3703: Bad Adaptation Descriptor found (tag 0) size is 0 but only 254 bytes available
=================================================================
==59092==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x625000018da4 at pc 0x7ffff4459f03 bp 0x7ffffffec2d0 sp 0x7ffffffec2c0
READ of size 1 at 0x625000018da4 thread T0
    #0 0x7ffff4459f02 in gf_m2ts_get_adaptation_field media_tools/mpegts.c:2429
    #1 0x7ffff446929d in gf_m2ts_process_packet media_tools/mpegts.c:2565
    #2 0x7ffff446c1e9 in gf_m2ts_process_data media_tools/mpegts.c:2842
    #3 0x7ffff4bc2616 in m2tsdmx_configure_pid filters/dmx_m2ts.c:1173
    #4 0x7ffff49e9b9e in gf_filter_pid_configure filter_core/filter_pid.c:876
    #5 0x7ffff49f256e in gf_filter_pid_connect_task filter_core/filter_pid.c:1230
    #6 0x7ffff4a2ab11 in gf_fs_thread_proc filter_core/filter_session.c:2105
    #7 0x7ffff4a2f8b6 in gf_fs_run filter_core/filter_session.c:2405
    #8 0x7ffff43bc0bd in gf_dasher_process media_tools/dash_segmenter.c:1236
    #9 0x555555621d26 in do_dash /home/fuzz/gpac/applications/mp4box/mp4box.c:4831
    #10 0x555555621d26 in mp4box_main /home/fuzz/gpac/applications/mp4box/mp4box.c:6245
    #11 0x7ffff164c082 in __libc_start_main ../csu/libc-start.c:308
    #12 0x5555555fa05d in _start (/home/fuzz/gpac/bin/gcc/MP4Box+0xa605d)

0x625000018da4 is located 0 bytes to the right of 9380-byte region [0x625000016900,0x625000018da4)
allocated by thread T0 here:
    #0 0x7ffff7690c3e in __interceptor_realloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:163
    #1 0x7ffff446c57b in gf_m2ts_process_data media_tools/mpegts.c:2793
    #2 0x7ffff4bc2616 in m2tsdmx_configure_pid filters/dmx_m2ts.c:1173
    #3 0x7ffff49e9b9e in gf_filter_pid_configure filter_core/filter_pid.c:876
    #4 0x7ffff49f256e in gf_filter_pid_connect_task filter_core/filter_pid.c:1230
    #5 0x7ffff4a2ab11 in gf_fs_thread_proc filter_core/filter_session.c:2105
    #6 0x7ffff4a2f8b6 in gf_fs_run filter_core/filter_session.c:2405
    #7 0x7ffff43bc0bd in gf_dasher_process media_tools/dash_segmenter.c:1236
    #8 0x555555621d26 in do_dash /home/fuzz/gpac/applications/mp4box/mp4box.c:4831
    #9 0x555555621d26 in mp4box_main /home/fuzz/gpac/applications/mp4box/mp4box.c:6245
    #10 0x7ffff164c082 in __libc_start_main ../csu/libc-start.c:308

SUMMARY: AddressSanitizer: heap-buffer-overflow media_tools/mpegts.c:2429 in gf_m2ts_get_adaptation_field
Shadow bytes around the buggy address:
  0x0c4a7fffb160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4a7fffb170: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4a7fffb180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4a7fffb190: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4a7fffb1a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c4a7fffb1b0: 00 00 00 00[04]fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a7fffb1c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a7fffb1d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a7fffb1e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a7fffb1f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a7fffb200: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==59092==ABORTING


Impact

This vulnerability is capable of crashing software, modify memory, and possible remote execution.
Occurrences

mpegts.c L2429

```
--- end body ---
