mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Fix(previews): prevent infinite loop in case of bad video file
Signed-off-by: invario <67800603+invario@users.noreply.github.com>
This commit is contained in:
parent
acb26a4507
commit
ba51caf5f4
1 changed files with 6 additions and 2 deletions
|
|
@ -164,6 +164,10 @@ class Movie extends ProviderV2 {
|
|||
// size of the atom. Needed for large atoms like 'mdat' (the video data)
|
||||
if ($atomSize === 1) {
|
||||
$atomSize = (int)hexdec(bin2hex(stream_get_contents($content, 8, (int)($offset + 8))));
|
||||
// 0 in the 64 bit field should not occur in a valid file, stop processing
|
||||
if ($atomSize === 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Found the 'moov' atom, store its location and size
|
||||
|
|
@ -194,9 +198,9 @@ class Movie extends ProviderV2 {
|
|||
// Copy first $size bytes of video into new file
|
||||
stream_copy_to_stream($content, $sparseFile, $size, 0);
|
||||
|
||||
// If 'moov' is located before $size in the video, it was already streamed,
|
||||
// If 'moov' is located entirely before $size in the video, it was already streamed,
|
||||
// so no need to download it again.
|
||||
if ($moovOffset >= $size) {
|
||||
if ($moovOffset + $moovSize >= $size) {
|
||||
// Seek to where 'moov' atom needs to be placed
|
||||
fseek($content, (int)$moovOffset);
|
||||
fseek($sparseFile, (int)$moovOffset);
|
||||
|
|
|
|||
Loading…
Reference in a new issue