Changeset 51400 in webkit
- Timestamp:
- Nov 25, 2009 4:44:39 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r51398 r51400 1 2009-11-25 Kenneth Russell <kbr@google.com> 2 3 Reviewed by Oliver Hunt. 4 5 Off-by-one error in index validation for drawElements and drawArrays 6 https://bugs.webkit.org/show_bug.cgi?id=31891 7 8 Fixed computation of number of elements for bound array objects. 9 10 Test: fast/canvas/webgl/index-validation.html 11 12 * fast/canvas/webgl/index-validation-expected.txt: Added. 13 * fast/canvas/webgl/index-validation.html: Added. 14 * fast/canvas/webgl/script-tests/index-validation.js: Added. 15 1 16 2009-11-25 Csaba Osztrogonác <ossy@webkit.org> 2 17 -
trunk/WebCore/ChangeLog
r51397 r51400 1 2009-11-25 Kenneth Russell <kbr@google.com> 2 3 Reviewed by Oliver Hunt. 4 5 Off-by-one error in index validation for drawElements and drawArrays 6 https://bugs.webkit.org/show_bug.cgi?id=31891 7 8 Fixed computation of number of elements for bound array objects. 9 10 Test: fast/canvas/webgl/index-validation.html 11 12 * html/canvas/WebGLRenderingContext.cpp: 13 (WebCore::WebGLRenderingContext::vertexAttribPointer): 14 1 15 2009-11-25 Dmitry Titov <dimich@chromium.org> 2 16 -
trunk/WebCore/html/canvas/WebGLRenderingContext.cpp
r51370 r51400 2047 2047 { 2048 2048 if (!m_boundArrayBuffer || indx >= m_maxVertexAttribs) { 2049 // FIXME: raise GL_INVALID_VALUE error 2049 2050 ec = INVALID_STATE_ERR; 2050 2051 return; … … 2059 2060 if (ec != 0) 2060 2061 return; 2061 2062 long validatedStride = bytesPerElement; 2062 2063 if (stride != 0) { 2063 2064 if ((long) stride < bytesPerElement) { 2065 // FIXME: raise GL_INVALID_VALUE error 2064 2066 ec = SYNTAX_ERR; 2065 2067 return; 2066 2068 } 2067 2069 2068 bytesPerElement = stride; 2069 } 2070 2071 m_vertexAttribState[indx].numElements = (m_boundArrayBuffer->byteLength(GraphicsContext3D::ARRAY_BUFFER) - offset) / bytesPerElement; 2070 validatedStride = stride; 2071 } 2072 2073 // Avoid off-by-one errors in numElements computation. 2074 // For the last element, we will only touch the data for the 2075 // element and nothing beyond it. 2076 long bytesRemaining = m_boundArrayBuffer->byteLength(GraphicsContext3D::ARRAY_BUFFER) - offset; 2077 if (bytesRemaining < bytesPerElement) 2078 m_vertexAttribState[indx].numElements = 0; 2079 else 2080 m_vertexAttribState[indx].numElements = 1 + (bytesRemaining - bytesPerElement) / validatedStride; 2072 2081 2073 2082 m_context->vertexAttribPointer(indx, size, type, normalized, stride, offset);
Note: See TracChangeset
for help on using the changeset viewer.