Fix stack limit exceeded in http client.
R=henrike@webrtc.org Review URL: https://webrtc-codereview.appspot.com/23419004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7165 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
a0d7827b16
commit
f7e5f22f98
@ -18,6 +18,7 @@
|
|||||||
#include "webrtc/base/httpclient.h"
|
#include "webrtc/base/httpclient.h"
|
||||||
#include "webrtc/base/logging.h"
|
#include "webrtc/base/logging.h"
|
||||||
#include "webrtc/base/pathutils.h"
|
#include "webrtc/base/pathutils.h"
|
||||||
|
#include "webrtc/base/scoped_ptr.h"
|
||||||
#include "webrtc/base/socketstream.h"
|
#include "webrtc/base/socketstream.h"
|
||||||
#include "webrtc/base/stringencode.h"
|
#include "webrtc/base/stringencode.h"
|
||||||
#include "webrtc/base/stringutils.h"
|
#include "webrtc/base/stringutils.h"
|
||||||
@ -596,8 +597,10 @@ HttpError HttpClient::ReadCacheBody(const std::string& id) {
|
|||||||
if ((HE_NONE == error)
|
if ((HE_NONE == error)
|
||||||
&& (HV_HEAD != request().verb)
|
&& (HV_HEAD != request().verb)
|
||||||
&& response().document) {
|
&& response().document) {
|
||||||
char buffer[1024 * 64];
|
// Allocate on heap to not explode the stack.
|
||||||
StreamResult result = Flow(stream.get(), buffer, ARRAY_SIZE(buffer),
|
const int array_size = 1024 * 64;
|
||||||
|
scoped_ptr<char[]> buffer(new char[array_size]);
|
||||||
|
StreamResult result = Flow(stream.get(), buffer.get(), array_size,
|
||||||
response().document.get());
|
response().document.get());
|
||||||
if (SR_SUCCESS != result) {
|
if (SR_SUCCESS != result) {
|
||||||
error = HE_STREAM;
|
error = HE_STREAM;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user