# Summary
Hi, developers of Bento4:
I tested the binary mp4edit with my fuzzer, and a crash incurred—SEGV on unknown address. The following is the details.


# Bug
Detected SEGV on unknown address in mp4edit.
```
root@2e47aa8b3277:/fuzz-mp4edit# ./../Bento4/cmakebuild/mp4edit out/crashes/id\:000002\,sig\:06\,src\:001821\,op\:havoc\,rep\:128\,211239629 /dev/null
WARNING: atom serialized to fewer bytes than declared size
WARNING: atom serialized to fewer bytes than declared size
WARNING: atom serialized to fewer bytes than declared size
WARNING: atom serialized to fewer bytes than declared size
AddressSanitizer:DEADLYSIGNAL
=================================================================
==2207040==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x00000054f7eb bp 0x7ffea710d720 sp 0x7ffea710d280 T0)
==2207040==The signal is caused by a READ memory access.
==2207040==Hint: address points to the zero page.
    #0 0x54f7eb in AP4_Processor::ProcessFragments(AP4_MoovAtom*, AP4_List<AP4_AtomLocator>&, AP4_ContainerAtom*, AP4_SidxAtom*, unsigned long long, AP4_ByteStream&, AP4_ByteStream&) (/Bento4/cmakebuild/mp4edit+0x54f7eb)
    #1 0x553ee9 in AP4_Processor::Process(AP4_ByteStream&, AP4_ByteStream&, AP4_ByteStream*, AP4_Processor::ProgressListener*, AP4_AtomFactory&) (/Bento4/cmakebuild/mp4edit+0x553ee9)
    #2 0x4fbcdb in main (/Bento4/cmakebuild/mp4edit+0x4fbcdb)
    #3 0x7f89e33bac86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)
    #4 0x41d9e9 in _start (/Bento4/cmakebuild/mp4edit+0x41d9e9)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/Bento4/cmakebuild/mp4edit+0x54f7eb) in AP4_Processor::ProcessFragments(AP4_MoovAtom*, AP4_List<AP4_AtomLocator>&, AP4_ContainerAtom*, AP4_SidxAtom*, unsigned long long, AP4_ByteStream&, AP4_ByteStream&)
==2207040==ABORTING

```


# POC
[POC_mp4edit_211239629.zip](https://github.com/axiomatic-systems/Bento4/files/9691911/POC_mp4edit_211239629.zip)


# Environment

Ubuntu 18.04.6 LTS (docker)
clang 12.0.1
clang++ 12.0.1
Bento4 master branch(5b7cc25) && Bento4 release version([1.6.0-639](https://www.bok.net/Bento4/binaries/Bento4-SDK-1-6-0-639.x86_64-unknown-linux.zip))



# Credit
Xudong Cao ([NCNIPC of China](http://www.nipc.org.cn/))
Han Zheng ([NCNIPC of China](http://www.nipc.org.cn/), [Hexhive](http://hexhive.epfl.ch/))


Thank you for your time!
SEGV on unknown address 0x000000000000 in mp4edit
This is a GitHub Issue
repo:Bento4
owner:axiomatic-systems
Title : SEGV on unknown address 0x000000000000 in mp4edit
Issue date:

--- start body ---
# Summary
Hi, developers of Bento4:
I tested the binary mp4edit with my fuzzer, and a crash incurred—SEGV on unknown address. The following is the details.


# Bug
Detected SEGV on unknown address in mp4edit.
```
root@2e47aa8b3277:/fuzz-mp4edit# ./../Bento4/cmakebuild/mp4edit out/crashes/id\:000002\,sig\:06\,src\:001821\,op\:havoc\,rep\:128\,211239629 /dev/null
WARNING: atom serialized to fewer bytes than declared size
WARNING: atom serialized to fewer bytes than declared size
WARNING: atom serialized to fewer bytes than declared size
WARNING: atom serialized to fewer bytes than declared size
AddressSanitizer:DEADLYSIGNAL
=================================================================
==2207040==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x00000054f7eb bp 0x7ffea710d720 sp 0x7ffea710d280 T0)
==2207040==The signal is caused by a READ memory access.
==2207040==Hint: address points to the zero page.
    #0 0x54f7eb in AP4_Processor::ProcessFragments(AP4_MoovAtom*, AP4_List<AP4_AtomLocator>&, AP4_ContainerAtom*, AP4_SidxAtom*, unsigned long long, AP4_ByteStream&, AP4_ByteStream&) (/Bento4/cmakebuild/mp4edit+0x54f7eb)
    #1 0x553ee9 in AP4_Processor::Process(AP4_ByteStream&, AP4_ByteStream&, AP4_ByteStream*, AP4_Processor::ProgressListener*, AP4_AtomFactory&) (/Bento4/cmakebuild/mp4edit+0x553ee9)
    #2 0x4fbcdb in main (/Bento4/cmakebuild/mp4edit+0x4fbcdb)
    #3 0x7f89e33bac86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)
    #4 0x41d9e9 in _start (/Bento4/cmakebuild/mp4edit+0x41d9e9)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/Bento4/cmakebuild/mp4edit+0x54f7eb) in AP4_Processor::ProcessFragments(AP4_MoovAtom*, AP4_List<AP4_AtomLocator>&, AP4_ContainerAtom*, AP4_SidxAtom*, unsigned long long, AP4_ByteStream&, AP4_ByteStream&)
==2207040==ABORTING

```


# POC
[POC_mp4edit_211239629.zip](https://github.com/axiomatic-systems/Bento4/files/9691911/POC_mp4edit_211239629.zip)


# Environment

Ubuntu 18.04.6 LTS (docker)
clang 12.0.1
clang++ 12.0.1
Bento4 master branch(5b7cc25) && Bento4 release version([1.6.0-639](https://www.bok.net/Bento4/binaries/Bento4-SDK-1-6-0-639.x86_64-unknown-linux.zip))



# Credit
Xudong Cao ([NCNIPC of China](http://www.nipc.org.cn/))
Han Zheng ([NCNIPC of China](http://www.nipc.org.cn/), [Hexhive](http://hexhive.epfl.ch/))


Thank you for your time!
--- end body ---
