Hello,

I find that in the AP4_Stz2Atom::AP4_Stz2Atom function, the sample_count obtained through stream.ReadUI08 may lack proper range validation. This can lead to a heap out-of-bounds read when calling AP4_BytesToUInt16BE, triggering a segment fault.

./mp42aac poc out

[poc.zip](https://github.com/axiomatic-systems/Bento4/files/14842435/poc.zip)

Out-Of-Bounds read in Ap4Stz2Atom
This is a GitHub Issue
repo:Bento4
owner:axiomatic-systems
Title : Out-Of-Bounds read in Ap4Stz2Atom
Issue date:

--- start body ---
Hello,

I find that in the AP4_Stz2Atom::AP4_Stz2Atom function, the sample_count obtained through stream.ReadUI08 may lack proper range validation. This can lead to a heap out-of-bounds read when calling AP4_BytesToUInt16BE, triggering a segment fault.

./mp42aac poc out

[poc.zip](https://github.com/axiomatic-systems/Bento4/files/14842435/poc.zip)

--- end body ---

In the AP4_Stz2Atom::AP4_Stz2Atom function of Bento4, the sample_count read from the stream lacks proper range validation. This can lead to a heap out-of-bounds read when calling AP4_BytesToUInt16BE, potentially causing a segmentation fault. This vulnerability could be exploited by an attacker to read memory outside the intended bounds, leading to information disclosure or application crashes.