Hi, there.

There is a segmentation fault caused by null pointer dereference in MP4fragment, Ap4MdhdAtom.cpp:69 in the newest commit 5b7cc250.

The reason for this issue is that the pointer of the parameter language is unchecked.
<img width="798" alt="image" src="https://user-images.githubusercontent.com/7632714/191883685-de179dff-fa13-47ea-ac20-282f4ac815dd.png">

To reproduce, run:
~~~~
./mp4fragment poc /dev/null
~~~~

Here is the trace reported by ASAN:
~~~~
==2203836==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f7614ee06e5 bp 0x7fffa38827d0 sp 0x7fffa3881f68 T0)
 ==2203836==The signal is caused by a READ memory access.
 ==2203836==Hint: address points to the zero page.
     #0 0x7f7614ee06e5  /build/glibc-SzIz7B/glibc-2.31/string/../sysdeps/x86_64/multiarch/strlen-avx2.S:65
     #1 0x46efac in __interceptor_strlen.part.0 /dependence/llvm11/llvm-11.0.0.src/projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:370:31
     #2 0x590708 in AP4_MdhdAtom::AP4_MdhdAtom(unsigned long long, unsigned long long, unsigned int, unsigned long long, char const*) /benchmark/Bento4/Source/C++/Core/Ap4MdhdAtom.cpp:69:9
     #3 0x621124 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*) /benchmark/Bento4/Source/C++/Core/Ap4TrakAtom.cpp:143:22
     #4 0x61e255 in AP4_Track::AP4_Track(AP4_SampleTable*, unsigned int, unsigned int, unsigned long long, unsigned int, unsigned long long, AP4_Track const*) /benchmark/Bento4/Source/C++/Core/Ap4Track.cpp:183:22
     #5 0x500733 in Fragment(AP4_File&, AP4_ByteStream&, AP4_Array<TrackCursor*>&, unsigned int, unsigned int, bool, bool, bool) /benchmark/Bento4/Source/C++/Apps/Mp4Fragment/Mp4Fragment.cpp:360:39
     #6 0x500733 in main /benchmark/Bento4/Source/C++/Apps/Mp4Fragment/Mp4Fragment.cpp:1475:5
     #7 0x7f7614d7c082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
     #8 0x41d8ad in _start (/benchmark/Bento4/build-a/mp4fragment+0x41d8ad)
 
 AddressSanitizer can not provide additional info.
 SUMMARY: AddressSanitizer: SEGV /build/glibc-SzIz7B/glibc-2.31/string/../sysdeps/x86_64/multiarch/strlen-avx2.S:65 
 ==2203836==ABORTING
~~~~

[poc.zip](https://github.com/axiomatic-systems/Bento4/files/9630471/mp4fragment_npd_Ap4MdhdAtom69.zip)
(unzip first)
Segmentation fault caused by null pointer dereference in MP4fragment, Ap4MdhdAtom.cpp:69
This is a GitHub Issue
repo:Bento4
owner:axiomatic-systems
Title : Segmentation fault caused by null pointer dereference in MP4fragment, Ap4MdhdAtom.cpp:69
Issue date:

--- start body ---
Hi, there.

There is a segmentation fault caused by null pointer dereference in MP4fragment, Ap4MdhdAtom.cpp:69 in the newest commit 5b7cc250.

The reason for this issue is that the pointer of the parameter language is unchecked.
<img width="798" alt="image" src="https://user-images.githubusercontent.com/7632714/191883685-de179dff-fa13-47ea-ac20-282f4ac815dd.png">

To reproduce, run:
~~~~
./mp4fragment poc /dev/null
~~~~

Here is the trace reported by ASAN:
~~~~
==2203836==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f7614ee06e5 bp 0x7fffa38827d0 sp 0x7fffa3881f68 T0)
 ==2203836==The signal is caused by a READ memory access.
 ==2203836==Hint: address points to the zero page.
     #0 0x7f7614ee06e5  /build/glibc-SzIz7B/glibc-2.31/string/../sysdeps/x86_64/multiarch/strlen-avx2.S:65
     #1 0x46efac in __interceptor_strlen.part.0 /dependence/llvm11/llvm-11.0.0.src/projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:370:31
     #2 0x590708 in AP4_MdhdAtom::AP4_MdhdAtom(unsigned long long, unsigned long long, unsigned int, unsigned long long, char const*) /benchmark/Bento4/Source/C++/Core/Ap4MdhdAtom.cpp:69:9
     #3 0x621124 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*) /benchmark/Bento4/Source/C++/Core/Ap4TrakAtom.cpp:143:22
     #4 0x61e255 in AP4_Track::AP4_Track(AP4_SampleTable*, unsigned int, unsigned int, unsigned long long, unsigned int, unsigned long long, AP4_Track const*) /benchmark/Bento4/Source/C++/Core/Ap4Track.cpp:183:22
     #5 0x500733 in Fragment(AP4_File&, AP4_ByteStream&, AP4_Array<TrackCursor*>&, unsigned int, unsigned int, bool, bool, bool) /benchmark/Bento4/Source/C++/Apps/Mp4Fragment/Mp4Fragment.cpp:360:39
     #6 0x500733 in main /benchmark/Bento4/Source/C++/Apps/Mp4Fragment/Mp4Fragment.cpp:1475:5
     #7 0x7f7614d7c082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
     #8 0x41d8ad in _start (/benchmark/Bento4/build-a/mp4fragment+0x41d8ad)
 
 AddressSanitizer can not provide additional info.
 SUMMARY: AddressSanitizer: SEGV /build/glibc-SzIz7B/glibc-2.31/string/../sysdeps/x86_64/multiarch/strlen-avx2.S:65 
 ==2203836==ABORTING
~~~~

[poc.zip](https://github.com/axiomatic-systems/Bento4/files/9630471/mp4fragment_npd_Ap4MdhdAtom69.zip)
(unzip first)
--- end body ---
