## 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-rev1678-g92faba3ed-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/7957274/poc.zip)

## Crash output


```
==27009==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x603000001e5e at pc 0x000000f8aab8 bp 0x7ffe2a4f7e30 sp 0x7ffe2a4f7e28
READ of size 1 at 0x603000001e5e thread T0
    #0 0xf8aab7 in isor_sai_bytes_removed /programs/mp4box/builds/build4/src/filters/isoffin_read_ch.c:783:22
    #1 0xf8c0ff in isor_reader_check_config /programs/mp4box/builds/build4/src/filters/isoffin_read_ch.c:894:5
    #2 0xf7acd7 in isoffin_process /programs/mp4box/builds/build4/src/filters/isoffin_read.c:1337:5
    #3 0xd8d9d9 in gf_filter_process_task /programs/mp4box/builds/build4/src/filter_core/filter.c:2515:7
    #4 0xd64cdf in gf_fs_thread_proc /programs/mp4box/builds/build4/src/filter_core/filter_session.c:1756:3
    #5 0xd63a13 in gf_fs_run /programs/mp4box/builds/build4/src/filter_core/filter_session.c:2000:2
    #6 0xaa9d40 in gf_media_fragment_file /programs/mp4box/builds/build4/src/media_tools/isom_tools.c:3816:6
    #7 0x4ebaff in mp4boxMain /programs/mp4box/builds/build4/applications/mp4box/main.c:6455:7
    #8 0x7fe18b4550b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
    #9 0x41ea6d in _start (/programs/mp4box/builds/build4/bin/gcc/MP4Box+0x41ea6d)

0x603000001e5e is located 0 bytes to the right of 30-byte region [0x603000001e40,0x603000001e5e)
allocated by thread T0 here:
    #0 0x499fe9 in realloc (/programs/mp4box/builds/build4/bin/gcc/MP4Box+0x499fe9)
    #1 0x8ed737 in isom_cenc_get_sai_by_saiz_saio /programs/mp4box/builds/build4/src/isomedia/drm_sample.c:1579:22
    #2 0x8ed737 in gf_isom_cenc_get_sample_aux_info /programs/mp4box/builds/build4/src/isomedia/drm_sample.c:1645:10
    #3 0xf8342e in isor_update_cenc_info /programs/mp4box/builds/build4/src/filters/isoffin_read_ch.c:236:7
    #4 0xf87420 in isor_reader_get_sample /programs/mp4box/builds/build4/src/filters/isoffin_read_ch.c:583:4
    #5 0xf7a947 in isoffin_process /programs/mp4box/builds/build4/src/filters/isoffin_read.c:1311:5
    #6 0xd8d9d9 in gf_filter_process_task /programs/mp4box/builds/build4/src/filter_core/filter.c:2515:7
    #7 0xd64cdf in gf_fs_thread_proc /programs/mp4box/builds/build4/src/filter_core/filter_session.c:1756:3
    #8 0xd63a13 in gf_fs_run /programs/mp4box/builds/build4/src/filter_core/filter_session.c:2000:2
    #9 0xaa9d40 in gf_media_fragment_file /programs/mp4box/builds/build4/src/media_tools/isom_tools.c:3816:6
    #10 0x4ebaff in mp4boxMain /programs/mp4box/builds/build4/applications/mp4box/main.c:6455:7
    #11 0x7fe18b4550b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)

SUMMARY: AddressSanitizer: heap-buffer-overflow /programs/mp4box/builds/build4/src/filters/isoffin_read_ch.c:783:22 in isor_sai_bytes_removed
Shadow bytes around the buggy address:
  0x0c067fff8370: fd fa fa fa fd fd fd fa fa fa fd fd fd fa fa fa
  0x0c067fff8380: fd fd fd fa fa fa fd fd fd fa fa fa fd fd fd fa
  0x0c067fff8390: fa fa fd fd fd fa fa fa fd fd fd fa fa fa fd fd
  0x0c067fff83a0: fd fa fa fa fd fd fd fa fa fa 00 00 00 fa fa fa
  0x0c067fff83b0: 00 00 04 fa fa fa fd fd fd fd fa fa fd fd fd fd
=>0x0c067fff83c0: fa fa 00 00 00 fa fa fa 00 00 00[06]fa fa 00 00
  0x0c067fff83d0: 00 00 fa fa 00 00 04 fa fa fa 00 00 00 00 fa fa
  0x0c067fff83e0: 00 00 00 06 fa fa 00 00 00 fa fa fa 00 00 00 fa
  0x0c067fff83f0: fa fa 00 00 00 00 fa fa 00 00 00 fa fa fa 00 00
  0x0c067fff8400: 00 fa fa fa fd fd fd fa fa fa 00 00 00 00 fa fa
  0x0c067fff8410: 00 00 00 00 fa fa 00 00 00 fa fa fa fd fd fd 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
==27009==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-rev1678-g92faba3ed-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/7957274/poc.zip)

## Crash output


```
==27009==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x603000001e5e at pc 0x000000f8aab8 bp 0x7ffe2a4f7e30 sp 0x7ffe2a4f7e28
READ of size 1 at 0x603000001e5e thread T0
    #0 0xf8aab7 in isor_sai_bytes_removed /programs/mp4box/builds/build4/src/filters/isoffin_read_ch.c:783:22
    #1 0xf8c0ff in isor_reader_check_config /programs/mp4box/builds/build4/src/filters/isoffin_read_ch.c:894:5
    #2 0xf7acd7 in isoffin_process /programs/mp4box/builds/build4/src/filters/isoffin_read.c:1337:5
    #3 0xd8d9d9 in gf_filter_process_task /programs/mp4box/builds/build4/src/filter_core/filter.c:2515:7
    #4 0xd64cdf in gf_fs_thread_proc /programs/mp4box/builds/build4/src/filter_core/filter_session.c:1756:3
    #5 0xd63a13 in gf_fs_run /programs/mp4box/builds/build4/src/filter_core/filter_session.c:2000:2
    #6 0xaa9d40 in gf_media_fragment_file /programs/mp4box/builds/build4/src/media_tools/isom_tools.c:3816:6
    #7 0x4ebaff in mp4boxMain /programs/mp4box/builds/build4/applications/mp4box/main.c:6455:7
    #8 0x7fe18b4550b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
    #9 0x41ea6d in _start (/programs/mp4box/builds/build4/bin/gcc/MP4Box+0x41ea6d)

0x603000001e5e is located 0 bytes to the right of 30-byte region [0x603000001e40,0x603000001e5e)
allocated by thread T0 here:
    #0 0x499fe9 in realloc (/programs/mp4box/builds/build4/bin/gcc/MP4Box+0x499fe9)
    #1 0x8ed737 in isom_cenc_get_sai_by_saiz_saio /programs/mp4box/builds/build4/src/isomedia/drm_sample.c:1579:22
    #2 0x8ed737 in gf_isom_cenc_get_sample_aux_info /programs/mp4box/builds/build4/src/isomedia/drm_sample.c:1645:10
    #3 0xf8342e in isor_update_cenc_info /programs/mp4box/builds/build4/src/filters/isoffin_read_ch.c:236:7
    #4 0xf87420 in isor_reader_get_sample /programs/mp4box/builds/build4/src/filters/isoffin_read_ch.c:583:4
    #5 0xf7a947 in isoffin_process /programs/mp4box/builds/build4/src/filters/isoffin_read.c:1311:5
    #6 0xd8d9d9 in gf_filter_process_task /programs/mp4box/builds/build4/src/filter_core/filter.c:2515:7
    #7 0xd64cdf in gf_fs_thread_proc /programs/mp4box/builds/build4/src/filter_core/filter_session.c:1756:3
    #8 0xd63a13 in gf_fs_run /programs/mp4box/builds/build4/src/filter_core/filter_session.c:2000:2
    #9 0xaa9d40 in gf_media_fragment_file /programs/mp4box/builds/build4/src/media_tools/isom_tools.c:3816:6
    #10 0x4ebaff in mp4boxMain /programs/mp4box/builds/build4/applications/mp4box/main.c:6455:7
    #11 0x7fe18b4550b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)

SUMMARY: AddressSanitizer: heap-buffer-overflow /programs/mp4box/builds/build4/src/filters/isoffin_read_ch.c:783:22 in isor_sai_bytes_removed
Shadow bytes around the buggy address:
  0x0c067fff8370: fd fa fa fa fd fd fd fa fa fa fd fd fd fa fa fa
  0x0c067fff8380: fd fd fd fa fa fa fd fd fd fa fa fa fd fd fd fa
  0x0c067fff8390: fa fa fd fd fd fa fa fa fd fd fd fa fa fa fd fd
  0x0c067fff83a0: fd fa fa fa fd fd fd fa fa fa 00 00 00 fa fa fa
  0x0c067fff83b0: 00 00 04 fa fa fa fd fd fd fd fa fa fd fd fd fd
=>0x0c067fff83c0: fa fa 00 00 00 fa fa fa 00 00 00[06]fa fa 00 00
  0x0c067fff83d0: 00 00 fa fa 00 00 04 fa fa fa 00 00 00 00 fa fa
  0x0c067fff83e0: 00 00 00 06 fa fa 00 00 00 fa fa fa 00 00 00 fa
  0x0c067fff83f0: fa fa 00 00 00 00 fa fa 00 00 00 fa fa fa 00 00
  0x0c067fff8400: 00 fa fa fa fd fd fd fa fa fa 00 00 00 00 fa fa
  0x0c067fff8410: 00 00 00 00 fa fa 00 00 00 fa fa fa fd fd fd 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
==27009==ABORTING
```
--- end body ---
