File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -164,6 +164,10 @@ private function getSparseFile(File $file, int $size): string|false {
164164 // size of the atom. Needed for large atoms like 'mdat' (the video data)
165165 if ($ atomSize === 1 ) {
166166 $ atomSize = (int )hexdec (bin2hex (stream_get_contents ($ content , 8 , (int )($ offset + 8 ))));
167+ // 0 in the 64 bit field should not occur in a valid file, stop processing
168+ if ($ atomSize === 0 ) {
169+ return false ;
170+ }
167171 }
168172 }
169173 // Found the 'moov' atom, store its location and size
@@ -194,9 +198,9 @@ private function getSparseFile(File $file, int $size): string|false {
194198 // Copy first $size bytes of video into new file
195199 stream_copy_to_stream ($ content , $ sparseFile , $ size , 0 );
196200
197- // If 'moov' is located before $size in the video, it was already streamed,
201+ // If 'moov' is located entirely before $size in the video, it was already streamed,
198202 // so no need to download it again.
199- if ($ moovOffset >= $ size ) {
203+ if ($ moovOffset + $ moovSize >= $ size ) {
200204 // Seek to where 'moov' atom needs to be placed
201205 fseek ($ content , (int )$ moovOffset );
202206 fseek ($ sparseFile , (int )$ moovOffset );
You can’t perform that action at this time.
0 commit comments