Prevent infinite loop in PipelineExtensions.PeekAsyncAwaited() (#1827).

This commit is contained in:
Cesar Blum Silveira 2017-05-12 16:04:38 -07:00 committed by GitHub
parent e149852d62
commit cb1d0f3956
1 changed files with 7 additions and 3 deletions

View File

@ -40,7 +40,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
}
finally
{
pipelineReader.Advance(result.Buffer.Start, result.Buffer.Start);
pipelineReader.Advance(result.Buffer.Start, result.Buffer.IsEmpty
? result.Buffer.End
: result.Buffer.Start);
}
input = pipelineReader.ReadAsync();
}
@ -68,7 +70,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
}
finally
{
pipelineReader.Advance(result.Buffer.Start, result.Buffer.Start);
pipelineReader.Advance(result.Buffer.Start, result.Buffer.IsEmpty
? result.Buffer.End
: result.Buffer.Start);
}
readingTask = pipelineReader.ReadAsync();
@ -325,4 +329,4 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
return bytes;
}
}
}
}