mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
Fixed: Zero length file causes MediaInfo hanging in 100% cpu load.
This commit is contained in:
parent
a1a5e29c3e
commit
2e08f195e4
@ -189,6 +189,11 @@ public int Open(string fileName)
|
||||
|
||||
public int Open(Stream stream)
|
||||
{
|
||||
if (stream.Length < 1024)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
var isValid = (int)MediaInfo_Open_Buffer_Init(_handle, stream.Length, 0);
|
||||
if (isValid == 1)
|
||||
{
|
||||
@ -203,7 +208,7 @@ public int Open(Stream stream)
|
||||
totalRead += bufferRead;
|
||||
|
||||
var status = (BufferStatus)MediaInfo_Open_Buffer_Continue(_handle, buffer, (IntPtr)bufferRead);
|
||||
|
||||
|
||||
if (status.HasFlag(BufferStatus.Finalized) || status <= 0 || bufferRead == 0)
|
||||
{
|
||||
Logger.Trace("Read file offset {0}-{1} ({2} bytes)", seekStart, stream.Position, stream.Position - seekStart);
|
||||
|
Loading…
Reference in New Issue
Block a user