Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp

Issue 1571233003: Fix errors caused by unsafe conversions to/from size_t (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: improved ALLOW_NUMERIC_ARG_TYPES_PROMOTABLE_TO Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org> 3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org>
4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org> 4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org>
5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved. 5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved.
6 * Copyright (C) 2012 Intel Corporation 6 * Copyright (C) 2012 Intel Corporation
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 DOMArrayBuffer* XMLHttpRequest::responseArrayBuffer() 354 DOMArrayBuffer* XMLHttpRequest::responseArrayBuffer()
355 { 355 {
356 ASSERT(m_responseTypeCode == ResponseTypeArrayBuffer); 356 ASSERT(m_responseTypeCode == ResponseTypeArrayBuffer);
357 357
358 if (m_error || m_state != DONE) 358 if (m_error || m_state != DONE)
359 return nullptr; 359 return nullptr;
360 360
361 if (!m_responseArrayBuffer) { 361 if (!m_responseArrayBuffer) {
362 if (m_binaryResponseBuilder && m_binaryResponseBuilder->size()) { 362 if (m_binaryResponseBuilder && m_binaryResponseBuilder->size()) {
363 RefPtr<DOMArrayBuffer> buffer = DOMArrayBuffer::createUninitialized( m_binaryResponseBuilder->size(), 1); 363 RefPtr<DOMArrayBuffer> buffer = DOMArrayBuffer::createUninitialized( m_binaryResponseBuilder->size(), 1);
364 if (!m_binaryResponseBuilder->getAsBytes(buffer->data(), buffer->byt eLength())) { 364 if (!m_binaryResponseBuilder->getAsBytes(buffer->data(), static_cast <size_t>(buffer->byteLength()))) {
365 // m_binaryResponseBuilder failed to allocate an ArrayBuffer. 365 // m_binaryResponseBuilder failed to allocate an ArrayBuffer.
366 // We need to crash the renderer since there's no way defined in 366 // We need to crash the renderer since there's no way defined in
367 // the spec to tell this to the user. 367 // the spec to tell this to the user.
368 CRASH(); 368 CRASH();
369 } 369 }
370 m_responseArrayBuffer = buffer.release(); 370 m_responseArrayBuffer = buffer.release();
371 m_binaryResponseBuilder.clear(); 371 m_binaryResponseBuilder.clear();
372 } else { 372 } else {
373 m_responseArrayBuffer = DOMArrayBuffer::create(nullptr, 0); 373 m_responseArrayBuffer = DOMArrayBuffer::create(nullptr, 0);
374 } 374 }
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 visitor->trace(m_responseDocumentParser); 1703 visitor->trace(m_responseDocumentParser);
1704 visitor->trace(m_progressEventThrottle); 1704 visitor->trace(m_progressEventThrottle);
1705 visitor->trace(m_upload); 1705 visitor->trace(m_upload);
1706 visitor->trace(m_blobLoader); 1706 visitor->trace(m_blobLoader);
1707 XMLHttpRequestEventTarget::trace(visitor); 1707 XMLHttpRequestEventTarget::trace(visitor);
1708 DocumentParserClient::trace(visitor); 1708 DocumentParserClient::trace(visitor);
1709 ActiveDOMObject::trace(visitor); 1709 ActiveDOMObject::trace(visitor);
1710 } 1710 }
1711 1711
1712 } // namespace blink 1712 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/xml/parser/SharedBufferReader.cpp ('k') | third_party/WebKit/Source/platform/SharedBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698