Hi, there is a stack memory exhaustion and program crash caused by an infinite recursion in the latest version of mp4info.
This vulnerability that may cause an infinite recursion via a crafted file.

Since each called function in a program allocates a stack frame on the stack, if a a function is recursively called so many times it can lead to stack memory exhaustion and program crash.
As a result, a remote attacker can leverage this for a DoS attack.
You can get the poc:
[poc.zip](https://github.com/axiomatic-systems/Bento4/files/8241422/poc.zip)

This is the Asan report:
```
./mp4info ./poc
File:
  major brand:      isom
  minor version:    200
  compatible brand: isom
  compatible brand: iso2
  compatible brand: avc1
  compatible brand: mp41
  fast start:       no

Movie:
  duration:   200 (media timescale units)
  duration:   200 (ms)
  time scale: 1000
  fragments:  no

Found 1 Tracks
Track 1:
  flags:        15 ENABLED IN-MOVIE IN-PREVIEW
  id:           1
  type:         Video
  duration: 200 ms
  language: und
  media:
    sample count: 6
    timescale:    0
    duration:     6 (media timescale units)
    duration:     0 (ms)
    bitrate (computed): 0.000 Kbps
  display width:  560.000000
  display height: 320.000000
  frame rate (computed): 0.000
  Sample Description 0
    Coding:       avc1 (H.264)
AddressSanitizer:DEADLYSIGNAL
=================================================================
==122421==ERROR: AddressSanitizer: stack-overflow on address 0x7ffc3ceb1ff8 (pc 0x0000005bdad8 bp 0x7ffc3ceb2010 sp 0x7ffc3ceb2000 T0)
    #0 0x5bdad8 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4SampleDescription.cpp:401
    #1 0x5474f4 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4DvccAtom.cpp:171:17
    #2 0x5bdc1a in AP4_AvcSampleDescription::GetCodecString(AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4SampleDescription.cpp:405:22
    #3 0x5474f4 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4DvccAtom.cpp:171:17
    #4 0x5bdc1a in AP4_AvcSampleDescription::GetCodecString(AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4SampleDescription.cpp:405:22
    #5 0x5474f4 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4DvccAtom.cpp:171:17
    #6 0x5bdc1a in AP4_AvcSampleDescription::GetCodecString(AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4SampleDescription.cpp:405:22
    #7 0x5474f4 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4DvccAtom.cpp:171:17
    #8 0x5bdc1a in AP4_AvcSampleDescription::GetCodecString(AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4SampleDescription.cpp:405:22
    #9 0x5474f4 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4DvccAtom.cpp:171:17
    #10 0x5bdc1a in AP4_AvcSampleDescription::GetCodecString(AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4SampleDescription.cpp:405:22
...............
    #246 0x5bdc1a in AP4_AvcSampleDescription::GetCodecString(AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4SampleDescription.cpp:405:22
    #247 0x5474f4 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4DvccAtom.cpp:171:17
    #248 0x5bdc1a in AP4_AvcSampleDescription::GetCodecString(AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4SampleDescription.cpp:405:22
```
As you can see, this makes the program go into an infinite loop and cause a stack overflow.
And it is compiled with:
```
make build && cd build
export CC=clang
export CXX=clang++
export CFLAGS="-fsanitize=address"
export CXXFLAGS="-fsanitize=address"
export LDFLAGS="-fsanitize=address"
cmake ..
make
make install
```

If you compile it without Asan(use gcc/g++), it will also cause a Segmentation fault:
```
./mp4info ./poc
File:
  major brand:      isom
  minor version:    200
  compatible brand: isom
  compatible brand: iso2
  compatible brand: avc1
  compatible brand: mp41
  fast start:       no

Movie:
  duration:   200 (media timescale units)
  duration:   200 (ms)
  time scale: 1000
  fragments:  no

Found 1 Tracks
Track 1:
  flags:        15 ENABLED IN-MOVIE IN-PREVIEW
  id:           1
  type:         Video
  duration: 200 ms
  language: und
  media:
    sample count: 6
    timescale:    0
    duration:     6 (media timescale units)
    duration:     0 (ms)
    bitrate (computed): 0.000 Kbps
  display width:  560.000000
  display height: 320.000000
  frame rate (computed): 0.000
  Sample Description 0
    Coding:       avc1 (H.264)
Segmentation fault
```
And gdb shows:
```
(gdb) bt
#0  0x0000555555581d2e in AP4_AtomFinder::AP4_AtomFinder(unsigned int, unsigned int) ()
#1  0x000055555557f328 in AP4_AtomParent::GetChild(unsigned int, unsigned int) const ()
#2  0x00005555555b9c40 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
#3  0x0000555555595797 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) ()
#4  0x00005555555b9c89 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
#5  0x0000555555595797 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) ()
#6  0x00005555555b9c89 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
#7  0x0000555555595797 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) ()
#8  0x00005555555b9c89 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
#9  0x0000555555595797 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) ()
#10 0x00005555555b9c89 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
#11 0x0000555555595797 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) ()
#12 0x00005555555b9c89 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
#13 0x0000555555595797 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) ()
#14 0x00005555555b9c89 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
#15 0x0000555555595797 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) ()
#16 0x00005555555b9c89 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
#17 0x0000555555595797 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) ()
#18 0x00005555555b9c89 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
#19 0x0000555555595797 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) ()
#20 0x00005555555b9c89 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
#21 0x0000555555595797 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) ()
#22 0x00005555555b9c89 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
#23 0x0000555555595797 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) ()
#24 0x00005555555b9c89 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
#25 0x0000555555595797 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) ()
#26 0x00005555555b9c89 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
#27 0x0000555555595797 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) ()
#28 0x00005555555b9c89 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
```
Test on:
os: ubuntu 20.04
version: the master branch
Bug: Stack memory exhaustion and program crash caused by an infinite recursion
This is a GitHub Issue
repo:Bento4
owner:axiomatic-systems
Title : Bug: Stack memory exhaustion and program crash caused by an infinite recursion
Issue date:

--- start body ---
Hi, there is a stack memory exhaustion and program crash caused by an infinite recursion in the latest version of mp4info.
This vulnerability that may cause an infinite recursion via a crafted file.

Since each called function in a program allocates a stack frame on the stack, if a a function is recursively called so many times it can lead to stack memory exhaustion and program crash.
As a result, a remote attacker can leverage this for a DoS attack.
You can get the poc:
[poc.zip](https://github.com/axiomatic-systems/Bento4/files/8241422/poc.zip)

This is the Asan report:
```
./mp4info ./poc
File:
  major brand:      isom
  minor version:    200
  compatible brand: isom
  compatible brand: iso2
  compatible brand: avc1
  compatible brand: mp41
  fast start:       no

Movie:
  duration:   200 (media timescale units)
  duration:   200 (ms)
  time scale: 1000
  fragments:  no

Found 1 Tracks
Track 1:
  flags:        15 ENABLED IN-MOVIE IN-PREVIEW
  id:           1
  type:         Video
  duration: 200 ms
  language: und
  media:
    sample count: 6
    timescale:    0
    duration:     6 (media timescale units)
    duration:     0 (ms)
    bitrate (computed): 0.000 Kbps
  display width:  560.000000
  display height: 320.000000
  frame rate (computed): 0.000
  Sample Description 0
    Coding:       avc1 (H.264)
AddressSanitizer:DEADLYSIGNAL
=================================================================
==122421==ERROR: AddressSanitizer: stack-overflow on address 0x7ffc3ceb1ff8 (pc 0x0000005bdad8 bp 0x7ffc3ceb2010 sp 0x7ffc3ceb2000 T0)
    #0 0x5bdad8 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4SampleDescription.cpp:401
    #1 0x5474f4 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4DvccAtom.cpp:171:17
    #2 0x5bdc1a in AP4_AvcSampleDescription::GetCodecString(AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4SampleDescription.cpp:405:22
    #3 0x5474f4 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4DvccAtom.cpp:171:17
    #4 0x5bdc1a in AP4_AvcSampleDescription::GetCodecString(AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4SampleDescription.cpp:405:22
    #5 0x5474f4 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4DvccAtom.cpp:171:17
    #6 0x5bdc1a in AP4_AvcSampleDescription::GetCodecString(AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4SampleDescription.cpp:405:22
    #7 0x5474f4 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4DvccAtom.cpp:171:17
    #8 0x5bdc1a in AP4_AvcSampleDescription::GetCodecString(AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4SampleDescription.cpp:405:22
    #9 0x5474f4 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4DvccAtom.cpp:171:17
    #10 0x5bdc1a in AP4_AvcSampleDescription::GetCodecString(AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4SampleDescription.cpp:405:22
...............
    #246 0x5bdc1a in AP4_AvcSampleDescription::GetCodecString(AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4SampleDescription.cpp:405:22
    #247 0x5474f4 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4DvccAtom.cpp:171:17
    #248 0x5bdc1a in AP4_AvcSampleDescription::GetCodecString(AP4_String&) /root/fuzz_workdir/Bento4/Source/C++/Core/Ap4SampleDescription.cpp:405:22
```
As you can see, this makes the program go into an infinite loop and cause a stack overflow.
And it is compiled with:
```
make build && cd build
export CC=clang
export CXX=clang++
export CFLAGS="-fsanitize=address"
export CXXFLAGS="-fsanitize=address"
export LDFLAGS="-fsanitize=address"
cmake ..
make
make install
```

If you compile it without Asan(use gcc/g++), it will also cause a Segmentation fault:
```
./mp4info ./poc
File:
  major brand:      isom
  minor version:    200
  compatible brand: isom
  compatible brand: iso2
  compatible brand: avc1
  compatible brand: mp41
  fast start:       no

Movie:
  duration:   200 (media timescale units)
  duration:   200 (ms)
  time scale: 1000
  fragments:  no

Found 1 Tracks
Track 1:
  flags:        15 ENABLED IN-MOVIE IN-PREVIEW
  id:           1
  type:         Video
  duration: 200 ms
  language: und
  media:
    sample count: 6
    timescale:    0
    duration:     6 (media timescale units)
    duration:     0 (ms)
    bitrate (computed): 0.000 Kbps
  display width:  560.000000
  display height: 320.000000
  frame rate (computed): 0.000
  Sample Description 0
    Coding:       avc1 (H.264)
Segmentation fault
```
And gdb shows:
```
(gdb) bt
#0  0x0000555555581d2e in AP4_AtomFinder::AP4_AtomFinder(unsigned int, unsigned int) ()
#1  0x000055555557f328 in AP4_AtomParent::GetChild(unsigned int, unsigned int) const ()
#2  0x00005555555b9c40 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
#3  0x0000555555595797 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) ()
#4  0x00005555555b9c89 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
#5  0x0000555555595797 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) ()
#6  0x00005555555b9c89 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
#7  0x0000555555595797 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) ()
#8  0x00005555555b9c89 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
#9  0x0000555555595797 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) ()
#10 0x00005555555b9c89 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
#11 0x0000555555595797 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) ()
#12 0x00005555555b9c89 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
#13 0x0000555555595797 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) ()
#14 0x00005555555b9c89 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
#15 0x0000555555595797 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) ()
#16 0x00005555555b9c89 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
#17 0x0000555555595797 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) ()
#18 0x00005555555b9c89 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
#19 0x0000555555595797 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) ()
#20 0x00005555555b9c89 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
#21 0x0000555555595797 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) ()
#22 0x00005555555b9c89 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
#23 0x0000555555595797 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) ()
#24 0x00005555555b9c89 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
#25 0x0000555555595797 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) ()
#26 0x00005555555b9c89 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
#27 0x0000555555595797 in AP4_DvccAtom::GetCodecString(AP4_SampleDescription*, AP4_String&) ()
#28 0x00005555555b9c89 in AP4_AvcSampleDescription::GetCodecString(AP4_String&) ()
```
Test on:
os: ubuntu 20.04
version: the master branch
--- end body ---
