## 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-rev1740-gbd98129fd-master
```

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

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

## Pocs

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


## Crash output

```
==18782==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6160000005a8 at pc 0x00000043c838 bp 0x7ffdafbe3de0 sp 0x7ffdafbe3560
READ of size 257 at 0x6160000005a8 thread T0
    #0 0x43c837 in printf_common(void*, char const*, __va_list_tag*) (/programs/mp4box/builds/build12/bin/gcc/MP4Box+0x43c837)
    #1 0x53d900 in gf_fprintf /programs/mp4box/builds/build12/src/utils/os_file.c:1620:9
    #2 0x7a91bd in bloc_box_dump /programs/mp4box/builds/build12/src/isomedia/box_dump.c:5936:2
    #3 0x7b2fcb in gf_isom_box_dump /programs/mp4box/builds/build12/src/isomedia/box_funcs.c:2065:2
    #4 0x782dba in gf_isom_dump /programs/mp4box/builds/build12/src/isomedia/box_dump.c:135:3
    #5 0x4f7f0c in dump_isom_xml /programs/mp4box/builds/build12/applications/mp4box/filedump.c:1954:6
    #6 0x4e0da8 in mp4boxMain /programs/mp4box/builds/build12/applications/mp4box/main.c:6171:7
    #7 0x7fecebfe50b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
    #8 0x41ea6d in _start (/programs/mp4box/builds/build12/bin/gcc/MP4Box+0x41ea6d)

0x6160000005a8 is located 0 bytes to the right of 552-byte region [0x616000000380,0x6160000005a8)
allocated by thread T0 here:
    #0 0x499ccd in malloc (/programs/mp4box/builds/build12/bin/gcc/MP4Box+0x499ccd)
    #1 0x1308bcf in bloc_box_new /programs/mp4box/builds/build12/src/isomedia/box_code_base.c:11496:2
    #2 0x7af501 in gf_isom_box_new_ex /programs/mp4box/builds/build12/src/isomedia/box_funcs.c:1685:6
    #3 0x7ad82d in gf_isom_box_parse_ex /programs/mp4box/builds/build12/src/isomedia/box_funcs.c:240:12
    #4 0x7ad181 in gf_isom_parse_root_box /programs/mp4box/builds/build12/src/isomedia/box_funcs.c:38:8
    #5 0x7c8b11 in gf_isom_parse_movie_boxes_internal /programs/mp4box/builds/build12/src/isomedia/isom_intern.c:349:7
    #6 0x7c8b11 in gf_isom_parse_movie_boxes /programs/mp4box/builds/build12/src/isomedia/isom_intern.c:812:6
    #7 0x7ccef6 in gf_isom_open_file /programs/mp4box/builds/build12/src/isomedia/isom_intern.c:932:19
    #8 0x4e14c6 in mp4boxMain /programs/mp4box/builds/build12/applications/mp4box/main.c:5984:12
    #9 0x7fecebfe50b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)

SUMMARY: AddressSanitizer: heap-buffer-overflow (/programs/mp4box/builds/build12/bin/gcc/MP4Box+0x43c837) in printf_common(void*, char const*, __va_list_tag*)
Shadow bytes around the buggy address:
  0x0c2c7fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2c7fff8070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c2c7fff8080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c2c7fff8090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c2c7fff80a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c2c7fff80b0: 00 00 00 00 00[fa]fa fa fa fa fa fa fa fa fa fa
  0x0c2c7fff80c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2c7fff80d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2c7fff80e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2c7fff80f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2c7fff8100: 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
==18782==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-rev1740-gbd98129fd-master
```

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

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

## Pocs

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


## Crash output

```
==18782==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6160000005a8 at pc 0x00000043c838 bp 0x7ffdafbe3de0 sp 0x7ffdafbe3560
READ of size 257 at 0x6160000005a8 thread T0
    #0 0x43c837 in printf_common(void*, char const*, __va_list_tag*) (/programs/mp4box/builds/build12/bin/gcc/MP4Box+0x43c837)
    #1 0x53d900 in gf_fprintf /programs/mp4box/builds/build12/src/utils/os_file.c:1620:9
    #2 0x7a91bd in bloc_box_dump /programs/mp4box/builds/build12/src/isomedia/box_dump.c:5936:2
    #3 0x7b2fcb in gf_isom_box_dump /programs/mp4box/builds/build12/src/isomedia/box_funcs.c:2065:2
    #4 0x782dba in gf_isom_dump /programs/mp4box/builds/build12/src/isomedia/box_dump.c:135:3
    #5 0x4f7f0c in dump_isom_xml /programs/mp4box/builds/build12/applications/mp4box/filedump.c:1954:6
    #6 0x4e0da8 in mp4boxMain /programs/mp4box/builds/build12/applications/mp4box/main.c:6171:7
    #7 0x7fecebfe50b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
    #8 0x41ea6d in _start (/programs/mp4box/builds/build12/bin/gcc/MP4Box+0x41ea6d)

0x6160000005a8 is located 0 bytes to the right of 552-byte region [0x616000000380,0x6160000005a8)
allocated by thread T0 here:
    #0 0x499ccd in malloc (/programs/mp4box/builds/build12/bin/gcc/MP4Box+0x499ccd)
    #1 0x1308bcf in bloc_box_new /programs/mp4box/builds/build12/src/isomedia/box_code_base.c:11496:2
    #2 0x7af501 in gf_isom_box_new_ex /programs/mp4box/builds/build12/src/isomedia/box_funcs.c:1685:6
    #3 0x7ad82d in gf_isom_box_parse_ex /programs/mp4box/builds/build12/src/isomedia/box_funcs.c:240:12
    #4 0x7ad181 in gf_isom_parse_root_box /programs/mp4box/builds/build12/src/isomedia/box_funcs.c:38:8
    #5 0x7c8b11 in gf_isom_parse_movie_boxes_internal /programs/mp4box/builds/build12/src/isomedia/isom_intern.c:349:7
    #6 0x7c8b11 in gf_isom_parse_movie_boxes /programs/mp4box/builds/build12/src/isomedia/isom_intern.c:812:6
    #7 0x7ccef6 in gf_isom_open_file /programs/mp4box/builds/build12/src/isomedia/isom_intern.c:932:19
    #8 0x4e14c6 in mp4boxMain /programs/mp4box/builds/build12/applications/mp4box/main.c:5984:12
    #9 0x7fecebfe50b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)

SUMMARY: AddressSanitizer: heap-buffer-overflow (/programs/mp4box/builds/build12/bin/gcc/MP4Box+0x43c837) in printf_common(void*, char const*, __va_list_tag*)
Shadow bytes around the buggy address:
  0x0c2c7fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2c7fff8070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c2c7fff8080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c2c7fff8090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c2c7fff80a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c2c7fff80b0: 00 00 00 00 00[fa]fa fa fa fa fa fa fa fa fa fa
  0x0c2c7fff80c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2c7fff80d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2c7fff80e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2c7fff80f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2c7fff8100: 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
==18782==ABORTING
```
--- end body ---
