From 06bcf38841fd2c04512e785e7dc858c15c055281 Mon Sep 17 00:00:00 2001 From: Kershaw Chang Date: Fri, 18 Dec 2020 12:37:13 +0000 Subject: [PATCH] Bug 1682800 - Make inflation fail if there is no enough memory r=necko-reviewers,valentin Differential Revision: https://phabricator.services.mozilla.com/D100060 --- netwerk/protocol/websocket/WebSocketChannel.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/netwerk/protocol/websocket/WebSocketChannel.cpp b/netwerk/protocol/websocket/WebSocketChannel.cpp index 3500529629e0..0193e4903e1d 100644 --- a/netwerk/protocol/websocket/WebSocketChannel.cpp +++ b/netwerk/protocol/websocket/WebSocketChannel.cpp @@ -855,7 +855,10 @@ class PMCECompression { uint32_t inflated = kBufferLen - mInflater.avail_out; if (inflated > 0) { - _retval.Append(reinterpret_cast(mBuffer), inflated); + if (!_retval.Append(reinterpret_cast(mBuffer), inflated, + fallible)) { + return NS_ERROR_OUT_OF_MEMORY; + } } mInflater.avail_out = kBufferLen;