## 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-rev1727-g8be34973d-master
```

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

## crash command
```
MP4Box -cprt TEXT -dxml -out /dev/null poc_file
```

## Pocs

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


## Crash output

```
==21084==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6030000010d2 at pc 0x0000007a51d3 bp 0x7ffe0b85dcf0 sp 0x7ffe0b85dce8
READ of size 1 at 0x6030000010d2 thread T0
    #0 0x7a51d2 in dump_data_hex/programs/mp4box/builds/build10/src/isomedia/box_dump.c:50:45
    #1 0x7a51d2 in senc_box_dump/programs/mp4box/builds/build10/src/isomedia/box_dump.c:5245:5
    #2 0x7b2d7b in gf_isom_box_dump/programs/mp4box/builds/build10/src/isomedia/box_funcs.c:2065:2
    #3 0x78297a in gf_isom_box_array_dump/programs/mp4box/builds/build10/src/isomedia/box_dump.c:101:3
    #4 0x7b35c5 in gf_isom_box_dump_done/programs/mp4box/builds/build10/src/isomedia/box_funcs.c:2072:3
    #5 0x784d03 in trak_box_dump/programs/mp4box/builds/build10/src/isomedia/box_dump.c:550:2
    #6 0x7b2d7b in gf_isom_box_dump/programs/mp4box/builds/build10/src/isomedia/box_funcs.c:2065:2
    #7 0x78297a in gf_isom_box_array_dump/programs/mp4box/builds/build10/src/isomedia/box_dump.c:101:3
    #8 0x7b35c5 in gf_isom_box_dump_done/programs/mp4box/builds/build10/src/isomedia/box_funcs.c:2072:3
    #9 0x7834ac in moov_box_dump/programs/mp4box/builds/build10/src/isomedia/box_dump.c:217:2
    #10 0x7b2d7b in gf_isom_box_dump/programs/mp4box/builds/build10/src/isomedia/box_funcs.c:2065:2
    #11 0x782c5a in gf_isom_dump/programs/mp4box/builds/build10/src/isomedia/box_dump.c:135:3
    #12 0x4f7e9c in dump_isom_xml/programs/mp4box/builds/build10/applications/mp4box/filedump.c:1950:6
    #13 0x4e0da8 in mp4boxMain/programs/mp4box/builds/build10/applications/mp4box/main.c:6171:7
    #14 0x7f332d85d0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
    #15 0x41ea6d in _start (/zhengjie/cmdline-fuzz/programs/mp4box/builds/build10/bin/gcc/MP4Box+0x41ea6d)

0x6030000010d2 is located 0 bytes to the right of 18-byte region [0x6030000010c0,0x6030000010d2)
allocated by thread T0 here:
    #0 0x499ccd in malloc (/zhengjie/cmdline-fuzz/programs/mp4box/builds/build10/bin/gcc/MP4Box+0x499ccd)
    #1 0x13165d6 in senc_Parse/programs/mp4box/builds/build10/src/isomedia/box_code_drm.c:1453:21
    #2 0x89e633 in MergeTrack/programs/mp4box/builds/build10/src/isomedia/track.c:1129:4
    #3 0x7c70d3 in MergeFragment/programs/mp4box/builds/build10/src/isomedia/isom_intern.c:92:7
    #4 0x7cb174 in gf_isom_parse_movie_boxes_internal/programs/mp4box/builds/build10/src/isomedia/isom_intern.c:681:9
    #5 0x7cb174 in gf_isom_parse_movie_boxes/programs/mp4box/builds/build10/src/isomedia/isom_intern.c:812:6
    #6 0x7ccca6 in gf_isom_open_file/programs/mp4box/builds/build10/src/isomedia/isom_intern.c:932:19
    #7 0x4e14c6 in mp4boxMain/programs/mp4box/builds/build10/applications/mp4box/main.c:5984:12
    #8 0x7f332d85d0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)

SUMMARY: AddressSanitizer: heap-buffer-overflow/programs/mp4box/builds/build10/src/isomedia/box_dump.c:50:45 in dump_data_hex
Shadow bytes around the buggy address:
  0x0c067fff81c0: 04 fa fa fa fd fd fd fa fa fa 00 00 00 00 fa fa
  0x0c067fff81d0: 00 00 00 fa fa fa 00 00 00 00 fa fa 00 00 02 fa
  0x0c067fff81e0: fa fa 00 00 00 00 fa fa 00 00 02 fa fa fa 00 00
  0x0c067fff81f0: 00 00 fa fa 00 00 00 fa fa fa 00 00 00 00 fa fa
  0x0c067fff8200: 00 00 00 fa fa fa 00 00 00 00 fa fa 00 00 00 fa
=>0x0c067fff8210: fa fa 00 00 00 00 fa fa 00 00[02]fa fa fa fd fd
  0x0c067fff8220: fd fd fa fa 00 00 00 fa fa fa 00 00 04 fa fa fa
  0x0c067fff8230: 00 00 01 fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c067fff8240: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c067fff8250: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c067fff8260: 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
==21084==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-rev1727-g8be34973d-master
```

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

## crash command
```
MP4Box -cprt TEXT -dxml -out /dev/null poc_file
```

## Pocs

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


## Crash output

```
==21084==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6030000010d2 at pc 0x0000007a51d3 bp 0x7ffe0b85dcf0 sp 0x7ffe0b85dce8
READ of size 1 at 0x6030000010d2 thread T0
    #0 0x7a51d2 in dump_data_hex/programs/mp4box/builds/build10/src/isomedia/box_dump.c:50:45
    #1 0x7a51d2 in senc_box_dump/programs/mp4box/builds/build10/src/isomedia/box_dump.c:5245:5
    #2 0x7b2d7b in gf_isom_box_dump/programs/mp4box/builds/build10/src/isomedia/box_funcs.c:2065:2
    #3 0x78297a in gf_isom_box_array_dump/programs/mp4box/builds/build10/src/isomedia/box_dump.c:101:3
    #4 0x7b35c5 in gf_isom_box_dump_done/programs/mp4box/builds/build10/src/isomedia/box_funcs.c:2072:3
    #5 0x784d03 in trak_box_dump/programs/mp4box/builds/build10/src/isomedia/box_dump.c:550:2
    #6 0x7b2d7b in gf_isom_box_dump/programs/mp4box/builds/build10/src/isomedia/box_funcs.c:2065:2
    #7 0x78297a in gf_isom_box_array_dump/programs/mp4box/builds/build10/src/isomedia/box_dump.c:101:3
    #8 0x7b35c5 in gf_isom_box_dump_done/programs/mp4box/builds/build10/src/isomedia/box_funcs.c:2072:3
    #9 0x7834ac in moov_box_dump/programs/mp4box/builds/build10/src/isomedia/box_dump.c:217:2
    #10 0x7b2d7b in gf_isom_box_dump/programs/mp4box/builds/build10/src/isomedia/box_funcs.c:2065:2
    #11 0x782c5a in gf_isom_dump/programs/mp4box/builds/build10/src/isomedia/box_dump.c:135:3
    #12 0x4f7e9c in dump_isom_xml/programs/mp4box/builds/build10/applications/mp4box/filedump.c:1950:6
    #13 0x4e0da8 in mp4boxMain/programs/mp4box/builds/build10/applications/mp4box/main.c:6171:7
    #14 0x7f332d85d0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
    #15 0x41ea6d in _start (/zhengjie/cmdline-fuzz/programs/mp4box/builds/build10/bin/gcc/MP4Box+0x41ea6d)

0x6030000010d2 is located 0 bytes to the right of 18-byte region [0x6030000010c0,0x6030000010d2)
allocated by thread T0 here:
    #0 0x499ccd in malloc (/zhengjie/cmdline-fuzz/programs/mp4box/builds/build10/bin/gcc/MP4Box+0x499ccd)
    #1 0x13165d6 in senc_Parse/programs/mp4box/builds/build10/src/isomedia/box_code_drm.c:1453:21
    #2 0x89e633 in MergeTrack/programs/mp4box/builds/build10/src/isomedia/track.c:1129:4
    #3 0x7c70d3 in MergeFragment/programs/mp4box/builds/build10/src/isomedia/isom_intern.c:92:7
    #4 0x7cb174 in gf_isom_parse_movie_boxes_internal/programs/mp4box/builds/build10/src/isomedia/isom_intern.c:681:9
    #5 0x7cb174 in gf_isom_parse_movie_boxes/programs/mp4box/builds/build10/src/isomedia/isom_intern.c:812:6
    #6 0x7ccca6 in gf_isom_open_file/programs/mp4box/builds/build10/src/isomedia/isom_intern.c:932:19
    #7 0x4e14c6 in mp4boxMain/programs/mp4box/builds/build10/applications/mp4box/main.c:5984:12
    #8 0x7f332d85d0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)

SUMMARY: AddressSanitizer: heap-buffer-overflow/programs/mp4box/builds/build10/src/isomedia/box_dump.c:50:45 in dump_data_hex
Shadow bytes around the buggy address:
  0x0c067fff81c0: 04 fa fa fa fd fd fd fa fa fa 00 00 00 00 fa fa
  0x0c067fff81d0: 00 00 00 fa fa fa 00 00 00 00 fa fa 00 00 02 fa
  0x0c067fff81e0: fa fa 00 00 00 00 fa fa 00 00 02 fa fa fa 00 00
  0x0c067fff81f0: 00 00 fa fa 00 00 00 fa fa fa 00 00 00 00 fa fa
  0x0c067fff8200: 00 00 00 fa fa fa 00 00 00 00 fa fa 00 00 00 fa
=>0x0c067fff8210: fa fa 00 00 00 00 fa fa 00 00[02]fa fa fa fd fd
  0x0c067fff8220: fd fd fa fa 00 00 00 fa fa fa 00 00 04 fa fa fa
  0x0c067fff8230: 00 00 01 fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c067fff8240: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c067fff8250: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c067fff8260: 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
==21084==ABORTING
```
--- end body ---
