Hi there,

I found a heap-buffer-overflow in ` AP4_AvccAtom::AP4_AvccAtom in Ap4AvccAtom.cpp:168` when fuzzing `mp42aac`.

- Bento4 version: v1.6.0-639 (commit 5abeaa0ebdb8c3be5b710517eb04d807832d2bbf)
- Compiler args:  DCMAKE_C_FLAGS=-fsanitize=address
- Platform: Ubuntu 20.04.2 LTS, x86_64
- Reproduce: `mp42aac heap_Ap4AvccAtom_poc /dev/null`
- POC: [heap_Ap4AvccAtom_poc.tar.gz](https://github.com/axiomatic-systems/Bento4/files/6908536/heap_Ap4AvccAtom_poc.tar.gz) (decompress it first)

AddressSanitizer report:
```
==70689==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000009e at pc 0x0000005543ab bp 0x7ffe748c1130 sp 0x7ffe748c1128
READ of size 1 at 0x60200000009e thread T0
    #0 0x5543aa in AP4_AvccAtom::AP4_AvccAtom(unsigned int, unsigned char const*) /mp42aac/repo/Source/C++/Core/Ap4AvccAtom.cpp:168:31
    #1 0x5514a0 in AP4_AvccAtom::Create(unsigned int, AP4_ByteStream&) /mp42aac/repo/Source/C++/Core/Ap4AvccAtom.cpp:95:16
    #2 0x54b13f in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&, unsigned int, unsigned int, unsigned long long, AP4_Atom*&) /mp42aac/repo/Source/C++/Core/Ap4AtomFactory.cpp:547:20
    #3 0x547a4c in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&, unsigned long long&, AP4_Atom*&) /mp42aac/repo/Source/C++/Core/Ap4AtomFactory.cpp:234:14
    #4 0x54717e in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&, AP4_Atom*&) /mp42aac/repo/Source/C++/Core/Ap4AtomFactory.cpp:154:12
    #5 0x4d4b1e in AP4_File::ParseStream(AP4_ByteStream&, AP4_AtomFactory&, bool) /mp42aac/repo/Source/C++/Core/Ap4File.cpp:104:12
    #6 0x4d5180 in AP4_File::AP4_File(AP4_ByteStream&, bool) /mp42aac/repo/Source/C++/Core/Ap4File.cpp:78:5
    #7 0x4cb2a1 in main /mp42aac/repo/Source/C++/Apps/Mp42Aac/Mp42Aac.cpp:250:22
    #8 0x7fea05b970b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
    #9 0x41c6cd in _start (/out_bin/mp42aac+0x41c6cd)

0x60200000009e is located 0 bytes to the right of 14-byte region [0x602000000090,0x60200000009e)
allocated by thread T0 here:
    #0 0x4c875d in operator new[](unsigned long) (/out_bin/mp42aac+0x4c875d)
    #1 0x4d2e66 in AP4_DataBuffer::AP4_DataBuffer(unsigned int) /mp42aac/repo/Source/C++/Core/Ap4DataBuffer.cpp:55:16

SUMMARY: AddressSanitizer: heap-buffer-overflow /mp42aac/repo/Source/C++/Core/Ap4AvccAtom.cpp:168:31 in AP4_AvccAtom::AP4_AvccAtom(unsigned int, unsigned char const*)
Shadow bytes around the buggy address:
  0x0c047fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c047fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c047fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c047fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c047fff8000: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 00
=>0x0c047fff8010: fa fa 00[06]fa fa 00 06 fa fa fa fa fa fa fa fa
  0x0c047fff8020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff8060: 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
==70689==ABORTING
```
heap-buffer-overflow in AP4_AvccAtom::AP4_AvccAtom in Ap4AvccAtom.cpp:168
This is a GitHub Issue
repo:Bento4
owner:axiomatic-systems
Title : heap-buffer-overflow in AP4_AvccAtom::AP4_AvccAtom in Ap4AvccAtom.cpp:168
Issue date:

--- start body ---
Hi there,

I found a heap-buffer-overflow in ` AP4_AvccAtom::AP4_AvccAtom in Ap4AvccAtom.cpp:168` when fuzzing `mp42aac`.

- Bento4 version: v1.6.0-639 (commit 5abeaa0ebdb8c3be5b710517eb04d807832d2bbf)
- Compiler args:  DCMAKE_C_FLAGS=-fsanitize=address
- Platform: Ubuntu 20.04.2 LTS, x86_64
- Reproduce: `mp42aac heap_Ap4AvccAtom_poc /dev/null`
- POC: [heap_Ap4AvccAtom_poc.tar.gz](https://github.com/axiomatic-systems/Bento4/files/6908536/heap_Ap4AvccAtom_poc.tar.gz) (decompress it first)

AddressSanitizer report:
```
==70689==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000009e at pc 0x0000005543ab bp 0x7ffe748c1130 sp 0x7ffe748c1128
READ of size 1 at 0x60200000009e thread T0
    #0 0x5543aa in AP4_AvccAtom::AP4_AvccAtom(unsigned int, unsigned char const*) /mp42aac/repo/Source/C++/Core/Ap4AvccAtom.cpp:168:31
    #1 0x5514a0 in AP4_AvccAtom::Create(unsigned int, AP4_ByteStream&) /mp42aac/repo/Source/C++/Core/Ap4AvccAtom.cpp:95:16
    #2 0x54b13f in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&, unsigned int, unsigned int, unsigned long long, AP4_Atom*&) /mp42aac/repo/Source/C++/Core/Ap4AtomFactory.cpp:547:20
    #3 0x547a4c in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&, unsigned long long&, AP4_Atom*&) /mp42aac/repo/Source/C++/Core/Ap4AtomFactory.cpp:234:14
    #4 0x54717e in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&, AP4_Atom*&) /mp42aac/repo/Source/C++/Core/Ap4AtomFactory.cpp:154:12
    #5 0x4d4b1e in AP4_File::ParseStream(AP4_ByteStream&, AP4_AtomFactory&, bool) /mp42aac/repo/Source/C++/Core/Ap4File.cpp:104:12
    #6 0x4d5180 in AP4_File::AP4_File(AP4_ByteStream&, bool) /mp42aac/repo/Source/C++/Core/Ap4File.cpp:78:5
    #7 0x4cb2a1 in main /mp42aac/repo/Source/C++/Apps/Mp42Aac/Mp42Aac.cpp:250:22
    #8 0x7fea05b970b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
    #9 0x41c6cd in _start (/out_bin/mp42aac+0x41c6cd)

0x60200000009e is located 0 bytes to the right of 14-byte region [0x602000000090,0x60200000009e)
allocated by thread T0 here:
    #0 0x4c875d in operator new[](unsigned long) (/out_bin/mp42aac+0x4c875d)
    #1 0x4d2e66 in AP4_DataBuffer::AP4_DataBuffer(unsigned int) /mp42aac/repo/Source/C++/Core/Ap4DataBuffer.cpp:55:16

SUMMARY: AddressSanitizer: heap-buffer-overflow /mp42aac/repo/Source/C++/Core/Ap4AvccAtom.cpp:168:31 in AP4_AvccAtom::AP4_AvccAtom(unsigned int, unsigned char const*)
Shadow bytes around the buggy address:
  0x0c047fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c047fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c047fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c047fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c047fff8000: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 00
=>0x0c047fff8010: fa fa 00[06]fa fa 00 06 fa fa fa fa fa fa fa fa
  0x0c047fff8020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff8060: 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
==70689==ABORTING
```
--- end body ---
