## Description
There is a heap buffer overflow detected by AddressSanitizer

## System info
```
Ubuntu 20.04.2 LTS
clang version 12.0.0-++20210402082642+04ba60cfe598-1~exp1~20210402063359.71
MP4Box - GPAC version 1.1.0-DEV-rev1754-g5430ebe10-master
```

## Build command
```
./configure --static-mp4box --prefix=`realpath ./install` --enable-sanitizer --cc=clang --cxx=clang++
```

## crash command
```
MP4Box -frag 0 -out /dev/null poc_file
```

## Pocs

[poc.zip](https://github.com/gpac/gpac/files/8058607/poc.zip)


## Crash output

```
==22362==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000044d1 at pc 0x000000d840e7 bp 0x7fff514ddb70 sp 0x7fff514ddb68
READ of size 1 at 0x6020000044d1 thread T0
    #0 0xd840e6 in mp4_mux_process_sample /programs/mp4box/builds/build14/src/filters/mux_isom.c
    #1 0xd77e18 in mp4_mux_process_fragmented /programs/mp4box/builds/build14/src/filters/mux_isom.c:5650:8
    #2 0xd7268f in mp4_mux_process /programs/mp4box/builds/build14/src/filters/mux_isom.c:6084:14
    #3 0xb7ebc6 in gf_filter_process_task /programs/mp4box/builds/build14/src/filter_core/filter.c:2573:7
    #4 0xb5f52e in gf_fs_thread_proc /programs/mp4box/builds/build14/src/filter_core/filter_session.c:1799:3
    #5 0xb5e3d4 in gf_fs_run /programs/mp4box/builds/build14/src/filter_core/filter_session.c:2043:2
    #6 0x911300 in gf_media_fragment_file /programs/mp4box/builds/build14/src/media_tools/isom_tools.c:3821:6
    #7 0x4e6fcc in mp4boxMain /programs/mp4box/builds/build14/applications/mp4box/main.c:6455:7
    #8 0x7f18921c50b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
    #9 0x41ea6d in _start (/programs/mp4box/builds/build14/bin/gcc/MP4Box+0x41ea6d)

0x6020000044d1 is located 0 bytes to the right of 1-byte region [0x6020000044d0,0x6020000044d1)
allocated by thread T0 here:
    #0 0x499ccd in malloc (/programs/mp4box/builds/build14/bin/gcc/MP4Box+0x499ccd)
    #1 0x156602e in gf_filter_pck_new_alloc_internal /programs/mp4box/builds/build14/src/filter_core/filter_pck.c:151:15
    #2 0xd09dad in isoffin_process /programs/mp4box/builds/build14/src/filters/isoffin_read.c:1343:12
    #3 0xb7ebc6 in gf_filter_process_task /programs/mp4box/builds/build14/src/filter_core/filter.c:2573:7
    #4 0xb5f52e in gf_fs_thread_proc /programs/mp4box/builds/build14/src/filter_core/filter_session.c:1799:3
    #5 0xb5e3d4 in gf_fs_run /programs/mp4box/builds/build14/src/filter_core/filter_session.c:2043:2
    #6 0x911300 in gf_media_fragment_file /programs/mp4box/builds/build14/src/media_tools/isom_tools.c:3821:6
    #7 0x4e6fcc in mp4boxMain /programs/mp4box/builds/build14/applications/mp4box/main.c:6455:7
    #8 0x7f18921c50b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)

SUMMARY: AddressSanitizer: heap-buffer-overflow /programs/mp4box/builds/build14/src/filters/mux_isom.c in mp4_mux_process_sample
Shadow bytes around the buggy address:
  0x0c047fff8840: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 00
  0x0c047fff8850: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa fd fa
  0x0c047fff8860: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 00
  0x0c047fff8870: fa fa 00 00 fa fa fd fa fa fa fd fd fa fa fd fa
  0x0c047fff8880: fa fa fd fa fa fa fd fd fa fa fd fd fa fa 00 00
=>0x0c047fff8890: fa fa 00 00 fa fa 00 00 fa fa[01]fa fa fa 00 00
  0x0c047fff88a0: fa fa fd fa fa fa fd fd fa fa fd fa fa fa fd fa
  0x0c047fff88b0: fa fa fd fd fa fa fd fd fa fa 00 00 fa fa 00 00
  0x0c047fff88c0: fa fa fd fa fa fa 00 00 fa fa 00 03 fa fa 02 fa
  0x0c047fff88d0: fa fa 02 fa fa fa 00 00 fa fa 00 00 fa fa fa fa
  0x0c047fff88e0: 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
==22362==ABORTING
```
There is a heap buffer overflow detected by AddressSanitizer
This is a GitHub Issue
repo:gpac
owner:gpac
Title : There is a heap buffer overflow detected by AddressSanitizer
Issue date:

--- start body ---
## Description
There is a heap buffer overflow detected by AddressSanitizer

## System info
```
Ubuntu 20.04.2 LTS
clang version 12.0.0-++20210402082642+04ba60cfe598-1~exp1~20210402063359.71
MP4Box - GPAC version 1.1.0-DEV-rev1754-g5430ebe10-master
```

## Build command
```
./configure --static-mp4box --prefix=`realpath ./install` --enable-sanitizer --cc=clang --cxx=clang++
```

## crash command
```
MP4Box -frag 0 -out /dev/null poc_file
```

## Pocs

[poc.zip](https://github.com/gpac/gpac/files/8058607/poc.zip)


## Crash output

```
==22362==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000044d1 at pc 0x000000d840e7 bp 0x7fff514ddb70 sp 0x7fff514ddb68
READ of size 1 at 0x6020000044d1 thread T0
    #0 0xd840e6 in mp4_mux_process_sample /programs/mp4box/builds/build14/src/filters/mux_isom.c
    #1 0xd77e18 in mp4_mux_process_fragmented /programs/mp4box/builds/build14/src/filters/mux_isom.c:5650:8
    #2 0xd7268f in mp4_mux_process /programs/mp4box/builds/build14/src/filters/mux_isom.c:6084:14
    #3 0xb7ebc6 in gf_filter_process_task /programs/mp4box/builds/build14/src/filter_core/filter.c:2573:7
    #4 0xb5f52e in gf_fs_thread_proc /programs/mp4box/builds/build14/src/filter_core/filter_session.c:1799:3
    #5 0xb5e3d4 in gf_fs_run /programs/mp4box/builds/build14/src/filter_core/filter_session.c:2043:2
    #6 0x911300 in gf_media_fragment_file /programs/mp4box/builds/build14/src/media_tools/isom_tools.c:3821:6
    #7 0x4e6fcc in mp4boxMain /programs/mp4box/builds/build14/applications/mp4box/main.c:6455:7
    #8 0x7f18921c50b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
    #9 0x41ea6d in _start (/programs/mp4box/builds/build14/bin/gcc/MP4Box+0x41ea6d)

0x6020000044d1 is located 0 bytes to the right of 1-byte region [0x6020000044d0,0x6020000044d1)
allocated by thread T0 here:
    #0 0x499ccd in malloc (/programs/mp4box/builds/build14/bin/gcc/MP4Box+0x499ccd)
    #1 0x156602e in gf_filter_pck_new_alloc_internal /programs/mp4box/builds/build14/src/filter_core/filter_pck.c:151:15
    #2 0xd09dad in isoffin_process /programs/mp4box/builds/build14/src/filters/isoffin_read.c:1343:12
    #3 0xb7ebc6 in gf_filter_process_task /programs/mp4box/builds/build14/src/filter_core/filter.c:2573:7
    #4 0xb5f52e in gf_fs_thread_proc /programs/mp4box/builds/build14/src/filter_core/filter_session.c:1799:3
    #5 0xb5e3d4 in gf_fs_run /programs/mp4box/builds/build14/src/filter_core/filter_session.c:2043:2
    #6 0x911300 in gf_media_fragment_file /programs/mp4box/builds/build14/src/media_tools/isom_tools.c:3821:6
    #7 0x4e6fcc in mp4boxMain /programs/mp4box/builds/build14/applications/mp4box/main.c:6455:7
    #8 0x7f18921c50b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)

SUMMARY: AddressSanitizer: heap-buffer-overflow /programs/mp4box/builds/build14/src/filters/mux_isom.c in mp4_mux_process_sample
Shadow bytes around the buggy address:
  0x0c047fff8840: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 00
  0x0c047fff8850: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa fd fa
  0x0c047fff8860: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 00
  0x0c047fff8870: fa fa 00 00 fa fa fd fa fa fa fd fd fa fa fd fa
  0x0c047fff8880: fa fa fd fa fa fa fd fd fa fa fd fd fa fa 00 00
=>0x0c047fff8890: fa fa 00 00 fa fa 00 00 fa fa[01]fa fa fa 00 00
  0x0c047fff88a0: fa fa fd fa fa fa fd fd fa fa fd fa fa fa fd fa
  0x0c047fff88b0: fa fa fd fd fa fa fd fd fa fa 00 00 fa fa 00 00
  0x0c047fff88c0: fa fa fd fa fa fa 00 00 fa fa 00 03 fa fa 02 fa
  0x0c047fff88d0: fa fa 02 fa fa fa 00 00 fa fa 00 00 fa fa fa fa
  0x0c047fff88e0: 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
==22362==ABORTING
```
--- end body ---
