RESOLVED FIXED 41383
Need to validate the size of the incoming arrays for uniform* functions
https://bugs.webkit.org/show_bug.cgi?id=41383
Summary Need to validate the size of the incoming arrays for uniform* functions
Zhenyao Mo
Reported 2010-06-29 16:39:10 PDT
either Float32Arrays or (float*, int size) argument pairs.
Attachments
patch (25.79 KB, patch)
2010-06-30 21:14 PDT, Zhenyao Mo
no flags
revised patch after kbr's clarification (26.10 KB, patch)
2010-07-01 15:49 PDT, Zhenyao Mo
no flags
revised patch: fixed the typo in the test. (27.47 KB, patch)
2010-07-01 17:07 PDT, Zhenyao Mo
no flags
Zhenyao Mo
Comment 1 2010-06-30 21:14:12 PDT
Kenneth Russell
Comment 2 2010-07-01 15:26:35 PDT
Gregg and I talked about this at length. The GL ES spec has this to say if you pass in too much data when setting elements in a uniform array (section 2.10, "Vertex Shaders", pp.36-37): "When loading N elements starting at an arbitrary position k in a uniform declared as an array, elements k through k + N − 1 in the array will be replaced with the new values. Values for any array element that exceeds the highest array element index used, as reported by GetActiveUniform, will be ignored by the GL." I think the only requirement should be that the incoming data (int*, Int32Array, float*, Float32Array) have at least one element of the given size (1, 2, 3, 4 for uniform[1234][fi]v, 1, 4, 9, 16 for uniformMatrix[1234]fv). I think the requirement that the number of elements in the array be a multiple of the size of the uniform should be dropped. The tests should then verify that passing in too little data raises INVALID_VALUE. Sorry about the confusion.
Zhenyao Mo
Comment 3 2010-07-01 15:35:22 PDT
(In reply to comment #2) > Gregg and I talked about this at length. The GL ES spec has this to say if you pass in too much data when setting elements in a uniform array (section 2.10, "Vertex Shaders", pp.36-37): > > "When loading N elements starting at an arbitrary position k in a uniform declared as an array, elements k through k + N − 1 in the array will be replaced with the new values. Values for any array element that exceeds the highest array element index used, as reported by GetActiveUniform, will be ignored by the GL." > > I think the only requirement should be that the incoming data (int*, Int32Array, float*, Float32Array) have at least one element of the given size (1, 2, 3, 4 for uniform[1234][fi]v, 1, 4, 9, 16 for uniformMatrix[1234]fv). I think the requirement that the number of elements in the array be a multiple of the size of the uniform should be dropped. The tests should then verify that passing in too little data raises INVALID_VALUE. > > Sorry about the confusion. No problem. I'll revise.
Zhenyao Mo
Comment 4 2010-07-01 15:49:05 PDT
Created attachment 60305 [details] revised patch after kbr's clarification
Kenneth Russell
Comment 5 2010-07-01 16:29:43 PDT
Comment on attachment 60305 [details] revised patch after kbr's clarification Code looks good. A couple of small typos in the test, not really necessary to fix. LayoutTests/fast/canvas/webgl/gl-uniform-arrays.html:165 + srcValues: [16, 15, 14, 13, 12, 11, 10, 11, 9], 11, 10, 11, 9 : did you mean to write 11, 10, 9, 8? LayoutTests/fast/canvas/webgl/gl-uniform-arrays.html:198 + srcValues: [16, 15, 14, 13, 12, 11, 10, 11, 9, 8, 7, 6], 11, 10, 11, 9, 8, 7, 6: did you mean 11, 10, 9, 8, 7, 6, 5?
Zhenyao Mo
Comment 6 2010-07-01 17:07:59 PDT
Created attachment 60317 [details] revised patch: fixed the typo in the test.
Kenneth Russell
Comment 7 2010-07-01 17:09:47 PDT
Comment on attachment 60317 [details] revised patch: fixed the typo in the test. Looks good.
Dimitri Glazkov (Google)
Comment 8 2010-07-02 08:46:15 PDT
Comment on attachment 60317 [details] revised patch: fixed the typo in the test. r=me.
WebKit Commit Bot
Comment 9 2010-07-02 09:21:11 PDT
Comment on attachment 60317 [details] revised patch: fixed the typo in the test. Clearing flags on attachment: 60317 Committed r62384: <http://trac.webkit.org/changeset/62384>
WebKit Commit Bot
Comment 10 2010-07-02 09:21:16 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.