mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 13:34:03 +00:00
Perform a better check of the buffer size in WebSockets.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/DOMEventTargetHelper.h"
|
||||
#include "mozilla/net/WebSocketChannel.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
@@ -2366,7 +2367,14 @@ WebSocket::Send(nsIInputStream* aMsgStream,
|
||||
}
|
||||
|
||||
// Always increment outgoing buffer len, even if closed
|
||||
mOutgoingBufferedAmount += aMsgLength;
|
||||
CheckedUint32 size = mOutgoingBufferedAmount;
|
||||
size += aMsgLength;
|
||||
if (!size.isValid()) {
|
||||
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return;
|
||||
}
|
||||
|
||||
mOutgoingBufferedAmount = size.value();
|
||||
|
||||
if (readyState == CLOSING ||
|
||||
readyState == CLOSED) {
|
||||
|
||||
Reference in New Issue
Block a user