File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -699,32 +699,39 @@ Action<Exception> error
699699 )
700700 {
701701 var exactLen = frame . ExactPayloadLength ;
702+
702703 if ( exactLen > PayloadData . MaxLength ) {
703704 var msg = "A frame has too long payload length." ;
705+
704706 throw new WebSocketException ( CloseStatusCode . TooBig , msg ) ;
705707 }
706708
707709 if ( exactLen == 0 ) {
708710 frame . _payloadData = PayloadData . Empty ;
711+
709712 completed ( frame ) ;
710713
711714 return ;
712715 }
713716
714717 var len = ( long ) exactLen ;
718+
715719 Action < byte [ ] > comp =
716720 bytes => {
717721 if ( bytes . LongLength != len ) {
718722 var msg = "The payload data of a frame could not be read." ;
723+
719724 throw new WebSocketException ( msg ) ;
720725 }
721726
722727 frame . _payloadData = new PayloadData ( bytes , len ) ;
728+
723729 completed ( frame ) ;
724730 } ;
725731
726732 if ( frame . _payloadLength < 127 ) {
727733 stream . ReadBytesAsync ( ( int ) exactLen , comp , error ) ;
734+
728735 return ;
729736 }
730737
You can’t perform that action at this time.
0 commit comments