Hi,
There is an out-of-bound read in AP4_MdhdAtom, Ap4MdhdAtom.cpp:69, in the latest commit [1529b83](https://github.com/axiomatic-systems/Bento4/commit/1529b83f89d52958b811469fc3ac5206639a3d0f), which also affects versions ranging from v1.4.2-590 to v1.6.0-641.

## How to reproduce

Here are the detailed reproduction steps using docker.

```bash
docker pull ubuntu:20.04 && docker run -it ubuntu:20.04 bash
## now step into the container
apt update && apt install wget git unzip gcc g++ make cmake libgc-dev -y
git clone https://github.com/axiomatic-systems/Bento4.git && pushd Bento4
## build binary mp4fragment
export CC="gcc" 
export CXX="g++"
export CFLAGS="-fsanitize=address -g"
export CXXFLAGS="-fsanitize=address -g"
cmake . && make -j
## obtain poc
wget https://github.com/axiomatic-systems/Bento4/files/13470851/mp4fragment_poc1.zip
unzip mp4fragment_poc1.zip
## reproducing command
./mp4fragment poc /dev/null
```

## Platform

- OS : ubuntu 20.04 (docker)
- gcc version 9.4.0 (default)

## ASAN

Here is the reproduction trace reported by ASAN:

```bash
root@d3932adedebb:/Bento4# ./mp4fragment ./mp4fragment_poc1 /dev/null
found regular I-frame interval: 1 frames (at -nan frames per second)
unable to autodetect fragment duration, using default
AddressSanitizer:DEADLYSIGNAL
=================================================================
==25771==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fbb24bbe6f5 bp 0x7ffdb6350650 sp 0x7ffdb634fdc8 T0)
==25771==The signal is caused by a READ memory access.
==25771==Hint: address points to the zero page.
    #0 0x7fbb24bbe6f4  (/lib/x86_64-linux-gnu/libc.so.6+0x1886f4)
    #1 0x7fbb24fdb90b in __interceptor_strlen ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:352
    #2 0x55f5f8014097 in AP4_MdhdAtom::AP4_MdhdAtom(unsigned long long, unsigned long long, unsigned int, unsigned long long, char const*) /Bento4/Source/C++/Core/Ap4MdhdAtom.cpp:69
    #3 0x55f5f8077a69 in AP4_TrakAtom::AP4_TrakAtom(AP4_SampleTable*, unsigned int, char const*, unsigned int, unsigned long long, unsigned long long, unsigned long long, unsigned int, unsigned long long, unsigned short, char const*, unsigned int, unsigned int, unsigned short, unsigned short, int const*) /Bento4/Source/C++/Core/Ap4TrakAtom.cpp:147
    #4 0x55f5f80751f4 in AP4_Track::AP4_Track(AP4_SampleTable*, unsigned int, unsigned int, unsigned long long, unsigned int, unsigned long long, AP4_Track const*) /Bento4/Source/C++/Core/Ap4Track.cpp:198
    #5 0x55f5f7fa87b9 in Fragment /Bento4/Source/C++/Apps/Mp4Fragment/Mp4Fragment.cpp:368
    #6 0x55f5f7fb0d5e in main /Bento4/Source/C++/Apps/Mp4Fragment/Mp4Fragment.cpp:1475
    #7 0x7fbb24a5a082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082)
    #8 0x55f5f7fa790d in _start (/Bento4/mp4fragment+0x32090d)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/lib/x86_64-linux-gnu/libc.so.6+0x1886f4) 
==25771==ABORTING
```

## Affected Version

v1.4.2-590-v1.6.0-641

## PoC

The PoC is available at 
[mp4fragment_poc1.zip](https://github.com/axiomatic-systems/Bento4/files/13470851/mp4fragment_poc1.zip)

Thanks for your time!
[BUG] OOB Read in mp4fragment , AP4_MdhdAtom, Ap4MdhdAtom.cpp:69
This is a GitHub Issue
repo:Bento4
owner:axiomatic-systems
Title : [BUG] OOB Read in mp4fragment , AP4_MdhdAtom, Ap4MdhdAtom.cpp:69
Issue date:

--- start body ---
Hi,
There is an out-of-bound read in AP4_MdhdAtom, Ap4MdhdAtom.cpp:69, in the latest commit [1529b83](https://github.com/axiomatic-systems/Bento4/commit/1529b83f89d52958b811469fc3ac5206639a3d0f), which also affects versions ranging from v1.4.2-590 to v1.6.0-641.

## How to reproduce

Here are the detailed reproduction steps using docker.

```bash
docker pull ubuntu:20.04 && docker run -it ubuntu:20.04 bash
## now step into the container
apt update && apt install wget git unzip gcc g++ make cmake libgc-dev -y
git clone https://github.com/axiomatic-systems/Bento4.git && pushd Bento4
## build binary mp4fragment
export CC="gcc" 
export CXX="g++"
export CFLAGS="-fsanitize=address -g"
export CXXFLAGS="-fsanitize=address -g"
cmake . && make -j
## obtain poc
wget https://github.com/axiomatic-systems/Bento4/files/13470851/mp4fragment_poc1.zip
unzip mp4fragment_poc1.zip
## reproducing command
./mp4fragment poc /dev/null
```

## Platform

- OS : ubuntu 20.04 (docker)
- gcc version 9.4.0 (default)

## ASAN

Here is the reproduction trace reported by ASAN:

```bash
root@d3932adedebb:/Bento4# ./mp4fragment ./mp4fragment_poc1 /dev/null
found regular I-frame interval: 1 frames (at -nan frames per second)
unable to autodetect fragment duration, using default
AddressSanitizer:DEADLYSIGNAL
=================================================================
==25771==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fbb24bbe6f5 bp 0x7ffdb6350650 sp 0x7ffdb634fdc8 T0)
==25771==The signal is caused by a READ memory access.
==25771==Hint: address points to the zero page.
    #0 0x7fbb24bbe6f4  (/lib/x86_64-linux-gnu/libc.so.6+0x1886f4)
    #1 0x7fbb24fdb90b in __interceptor_strlen ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:352
    #2 0x55f5f8014097 in AP4_MdhdAtom::AP4_MdhdAtom(unsigned long long, unsigned long long, unsigned int, unsigned long long, char const*) /Bento4/Source/C++/Core/Ap4MdhdAtom.cpp:69
    #3 0x55f5f8077a69 in AP4_TrakAtom::AP4_TrakAtom(AP4_SampleTable*, unsigned int, char const*, unsigned int, unsigned long long, unsigned long long, unsigned long long, unsigned int, unsigned long long, unsigned short, char const*, unsigned int, unsigned int, unsigned short, unsigned short, int const*) /Bento4/Source/C++/Core/Ap4TrakAtom.cpp:147
    #4 0x55f5f80751f4 in AP4_Track::AP4_Track(AP4_SampleTable*, unsigned int, unsigned int, unsigned long long, unsigned int, unsigned long long, AP4_Track const*) /Bento4/Source/C++/Core/Ap4Track.cpp:198
    #5 0x55f5f7fa87b9 in Fragment /Bento4/Source/C++/Apps/Mp4Fragment/Mp4Fragment.cpp:368
    #6 0x55f5f7fb0d5e in main /Bento4/Source/C++/Apps/Mp4Fragment/Mp4Fragment.cpp:1475
    #7 0x7fbb24a5a082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082)
    #8 0x55f5f7fa790d in _start (/Bento4/mp4fragment+0x32090d)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/lib/x86_64-linux-gnu/libc.so.6+0x1886f4) 
==25771==ABORTING
```

## Affected Version

v1.4.2-590-v1.6.0-641

## PoC

The PoC is available at 
[mp4fragment_poc1.zip](https://github.com/axiomatic-systems/Bento4/files/13470851/mp4fragment_poc1.zip)

Thanks for your time!
--- end body ---
