Changeset 63017 in webkit


Ignore:
Timestamp:
Jul 9, 2010 5:47:59 PM (14 years ago)
Author:
kbr@google.com
Message:

2010-07-09 Kenneth Russell <kbr@google.com>

Reviewed by Nate Chapin.

bufferSubData causes crash in WebGLBuffer::associateBufferSubData
https://bugs.webkit.org/show_bug.cgi?id=42004

Test: fast/canvas/webgl/index-validation-crash-with-buffer-sub-data.html

  • html/canvas/WebGLBuffer.cpp: (WebCore::WebGLBuffer::associateBufferData):
    • Allocate m_elementArrayBuffer for entry point taking only size. Guard against allocation failures of m_elementArrayBuffer.

(WebCore::WebGLBuffer::associateBufferSubData):

  • Guard against any possibility of crashes due to m_elementArrayBuffer being NULL.

2010-07-09 Kenneth Russell <kbr@google.com>

Reviewed by Nate Chapin.

bufferSubData causes crash in WebGLBuffer::associateBufferSubData
https://bugs.webkit.org/show_bug.cgi?id=42004

  • fast/canvas/webgl/index-validation-crash-with-buffer-sub-data-expected.txt: Added.
  • fast/canvas/webgl/index-validation-crash-with-buffer-sub-data.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r63016 r63017  
     12010-07-09  Kenneth Russell  <kbr@google.com>
     2
     3        Reviewed by Nate Chapin.
     4
     5        bufferSubData causes crash in WebGLBuffer::associateBufferSubData
     6        https://bugs.webkit.org/show_bug.cgi?id=42004
     7
     8        * fast/canvas/webgl/index-validation-crash-with-buffer-sub-data-expected.txt: Added.
     9        * fast/canvas/webgl/index-validation-crash-with-buffer-sub-data.html: Added.
     10
    1112010-07-09  Kenneth Russell  <kbr@google.com>
    212
  • trunk/WebCore/ChangeLog

    r63014 r63017  
     12010-07-09  Kenneth Russell  <kbr@google.com>
     2
     3        Reviewed by Nate Chapin.
     4
     5        bufferSubData causes crash in WebGLBuffer::associateBufferSubData
     6        https://bugs.webkit.org/show_bug.cgi?id=42004
     7
     8        Test: fast/canvas/webgl/index-validation-crash-with-buffer-sub-data.html
     9
     10        * html/canvas/WebGLBuffer.cpp:
     11        (WebCore::WebGLBuffer::associateBufferData):
     12         - Allocate m_elementArrayBuffer for entry point taking only size.
     13           Guard against allocation failures of m_elementArrayBuffer.
     14        (WebCore::WebGLBuffer::associateBufferSubData):
     15         - Guard against any possibility of crashes due to m_elementArrayBuffer being NULL.
     16
    1172010-07-09  Dumitru Daniliuc  <dumi@chromium.org>
    218
  • trunk/WebCore/html/canvas/WebGLBuffer.cpp

    r61934 r63017  
    5555bool WebGLBuffer::associateBufferData(int size)
    5656{
    57     switch (m_target) {
    58     case GraphicsContext3D::ELEMENT_ARRAY_BUFFER:
    59     case GraphicsContext3D::ARRAY_BUFFER:
     57    if (!m_target)
     58        return false;
     59
     60    if (m_target == GraphicsContext3D::ELEMENT_ARRAY_BUFFER) {
     61        m_byteLength = size;
     62        clearCachedMaxIndices();
     63        m_elementArrayBuffer = ArrayBuffer::create(size, 1);
     64        if (!m_elementArrayBuffer) {
     65            m_byteLength = 0;
     66            return false;
     67        }
     68        return true;
     69    } else if (m_target == GraphicsContext3D::ARRAY_BUFFER) {
    6070        m_byteLength = size;
    6171        return true;
    62     default:
    63         return false;
    6472    }
     73
     74    return false;
    6575}
    6676
     
    7989        // must never be able to change the validation results.
    8090        m_elementArrayBuffer = ArrayBuffer::create(array->buffer().get());
     91        if (!m_elementArrayBuffer) {
     92            m_byteLength = 0;
     93            return false;
     94        }
    8195        return true;
    8296    }
     
    108122            return false;
    109123           
     124        if (!m_elementArrayBuffer)
     125            return false;
     126
    110127        memcpy(static_cast<unsigned char*>(m_elementArrayBuffer->data()) + offset, array->baseAddress(), array->byteLength());
    111128        return true;
Note: See TracChangeset for help on using the changeset viewer.