Changeset 62961 in webkit


Ignore:
Timestamp:
Jul 9, 2010 9:43:38 AM (14 years ago)
Author:
kbr@google.com
Message:

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

Reviewed by Dimitri Glazkov.

Crash with uniform array test
https://bugs.webkit.org/show_bug.cgi?id=36028

  • bindings/v8/custom/V8WebGLRenderingContextCustom.cpp: (WebCore::vertexAttribAndUniformHelperf): (WebCore::uniformHelperi): (WebCore::uniformMatrixHelper):
    • Fixed type tests and casting of incoming arrays.
  • html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::getUniform):
    • Fixed crash when null WebGLUniform is passed to getUniform.

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

Reviewed by Dimitri Glazkov.

Crash with uniform array test
https://bugs.webkit.org/show_bug.cgi?id=36028

  • fast/canvas/webgl/gl-uniform-arrays-expected.txt:
    • Updated test expectations.
  • fast/canvas/webgl/gl-uniform-arrays.html:
    • Separated calling wrong uniform*fv entry point from calling with non-array.
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r62960 r62961  
     12010-07-09  Kenneth Russell  <kbr@google.com>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        Crash with uniform array test
     6        https://bugs.webkit.org/show_bug.cgi?id=36028
     7
     8        * fast/canvas/webgl/gl-uniform-arrays-expected.txt:
     9         - Updated test expectations.
     10        * fast/canvas/webgl/gl-uniform-arrays.html:
     11         - Separated calling wrong uniform*fv entry point from calling with non-array.
     12
    1132010-07-09  Chris Fleizach  <cfleizach@apple.com>
    214
  • trunk/LayoutTests/fast/canvas/webgl/gl-uniform-arrays-expected.txt

    r62384 r62961  
    4343PASS value put in ([12, 11]) matches value pulled out ([12, 11])
    4444PASS using the wrong size of gl.Uniform fails
     45PASS passing non-array to glUniform*fv should throw TypeError
    4546PASS can call gl.useProgram(null)
    4647
     
    6364PASS value put in ([10, 9, 8]) matches value pulled out ([10, 9, 8])
    6465PASS using the wrong size of gl.Uniform fails
     66PASS passing non-array to glUniform*fv should throw TypeError
    6567PASS can call gl.useProgram(null)
    6668
     
    8385PASS value put in ([8, 7, 6, 5]) matches value pulled out ([8, 7, 6, 5])
    8486PASS using the wrong size of gl.Uniform fails
     87PASS passing non-array to glUniform*fv should throw TypeError
    8588PASS can call gl.useProgram(null)
    8689
  • trunk/LayoutTests/fast/canvas/webgl/gl-uniform-arrays.html

    r62384 r62961  
    9191    elem: '',
    9292    numSrcValues: 3,
    93     badSet: function(loc) {
     93    invalidSet: function(loc) {
    9494      gl.uniform2fv(loc, [1, 2]);
    9595    },
     
    114114    elem: '[1]',
    115115    numSrcValues: 3,
    116     badSet: function(loc) {
     116    invalidSet: function(loc) {
    117117      gl.uniform1fv(loc, [2]);
     118    },
     119    illegalSet: function(loc) {
     120      gl.uniform1fv(loc, 2);
    118121    },
    119122    srcValueAsString: function(index, srcValues) {
     
    141144    elem: '[2]',
    142145    numSrcValues: 3,
    143     badSet: function(loc) {
     146    invalidSet: function(loc) {
    144147      gl.uniform1fv(loc, [2]);
     148    },
     149    illegalSet: function(loc) {
     150      gl.uniform1fv(loc, 2);
    145151    },
    146152    srcValueAsString: function(index, srcValues) {
     
    171177    elem: '[3]',
    172178    numSrcValues: 3,
    173     badSet: function(loc) {
     179    invalidSet: function(loc) {
    174180      gl.uniform1fv(loc, [2]);
     181    },
     182    illegalSet: function(loc) {
     183      gl.uniform1fv(loc, 2);
    175184    },
    176185    srcValueAsString: function(index, srcValues) {
     
    249258              typeInfo.returnValueAsString(value) + ")");
    250259  }
    251   typeInfo.badSet(loc);
     260  typeInfo.invalidSet(loc);
    252261  assertMsg(gl.getError() == gl.INVALID_OPERATION,
    253262            "using the wrong size of gl.Uniform fails");
     263  var exceptionCaught = false;
     264  if (typeInfo.illegalSet) {
     265    try {
     266      typeInfo.illegalSet(loc);
     267    } catch (e) {
     268      exceptionCaught = true;
     269    }
     270    assertMsg(exceptionCaught, "passing non-array to glUniform*fv should throw TypeError");
     271  }
    254272
    255273  gl.useProgram(null);
  • trunk/WebCore/ChangeLog

    r62960 r62961  
     12010-07-09  Kenneth Russell  <kbr@google.com>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        Crash with uniform array test
     6        https://bugs.webkit.org/show_bug.cgi?id=36028
     7
     8        * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:
     9        (WebCore::vertexAttribAndUniformHelperf):
     10        (WebCore::uniformHelperi):
     11        (WebCore::uniformMatrixHelper):
     12         - Fixed type tests and casting of incoming arrays.
     13        * html/canvas/WebGLRenderingContext.cpp:
     14        (WebCore::WebGLRenderingContext::getUniform):
     15         - Fixed crash when null WebGLUniform is passed to getUniform.
     16
    1172010-07-09  Chris Fleizach  <cfleizach@apple.com>
    218
  • trunk/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp

    r62158 r62961  
    478478    }
    479479
     480    if (args[1].IsEmpty() || !args[1]->IsArray()) {
     481        V8Proxy::throwTypeError();
     482        return notHandledByInterceptor();
     483    }
    480484    v8::Handle<v8::Array> array =
    481485      v8::Local<v8::Array>::Cast(args[1]);
    482     if (array.IsEmpty()) {
    483         V8Proxy::setDOMException(SYNTAX_ERR);
    484         return notHandledByInterceptor();
    485     }
    486486    uint32_t len = array->Length();
    487487    float* data = jsArrayToFloatArray(array, len);
     
    546546    }
    547547
     548    if (args[1].IsEmpty() || !args[1]->IsArray()) {
     549        V8Proxy::throwTypeError();
     550        return notHandledByInterceptor();
     551    }
    548552    v8::Handle<v8::Array> array =
    549553      v8::Local<v8::Array>::Cast(args[1]);
    550     if (array.IsEmpty()) {
    551         V8Proxy::setDOMException(SYNTAX_ERR);
    552         return notHandledByInterceptor();
    553     }
    554554    uint32_t len = array->Length();
    555555    int* data = jsArrayToIntArray(array, len);
     
    659659    }
    660660
     661    if (args[2].IsEmpty() || !args[2]->IsArray()) {
     662        V8Proxy::throwTypeError();
     663        return notHandledByInterceptor();
     664    }
    661665    v8::Handle<v8::Array> array =
    662666      v8::Local<v8::Array>::Cast(args[2]);
    663     if (array.IsEmpty()) {
    664         V8Proxy::setDOMException(SYNTAX_ERR);
    665         return notHandledByInterceptor();
    666     }
    667667    uint32_t len = array->Length();
    668668    float* data = jsArrayToFloatArray(array, len);
  • trunk/WebCore/html/canvas/WebGLRenderingContext.cpp

    r62458 r62961  
    15581558    if (!validateWebGLObject(program))
    15591559        return WebGLGetInfo();
     1560    if (!uniformLocation) {
     1561        m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
     1562        return WebGLGetInfo();
     1563    }
    15601564    if (uniformLocation->program() != program) {
    15611565        m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
Note: See TracChangeset for help on using the changeset viewer.