<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>122610</bug_id>
          
          <creation_ts>2013-10-10 11:46:00 -0700</creation_ts>
          <short_desc>Validate uniform input when setting texture sampler uniforms</short_desc>
          <delta_ts>2014-01-10 14:40:16 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebGL</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>122607</dependson>
          <blocked>126775</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Roger Fong">roger_fong</reporter>
          <assigned_to name="Roger Fong">roger_fong</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>dino</cc>
    
    <cc>esprehn+autocc</cc>
    
    <cc>gyuyoung.kim</cc>
    
    <cc>kondapallykalyan</cc>
    
    <cc>roger_fong</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>938446</commentid>
    <comment_count>0</comment_count>
    <who name="Roger Fong">roger_fong</who>
    <bug_when>2013-10-10 11:46:00 -0700</bug_when>
    <thetext>We have to make sure when we set a texture sampler that the value is less than the max combined texture units, otherwise we throw an INVALID_VALUE error.

The conformance test, conformance/uniforms/uniform-samplers-test.html, covers this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>938448</commentid>
    <comment_count>1</comment_count>
    <who name="Roger Fong">roger_fong</who>
    <bug_when>2013-10-10 11:46:47 -0700</bug_when>
    <thetext>Fix relies on https://bugs.webkit.org/show_bug.cgi?id=122607 to be committed first.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>938518</commentid>
    <comment_count>2</comment_count>
      <attachid>213923</attachid>
    <who name="Roger Fong">roger_fong</who>
    <bug_when>2013-10-10 13:33:38 -0700</bug_when>
    <thetext>Created attachment 213923
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>938567</commentid>
    <comment_count>3</comment_count>
      <attachid>213923</attachid>
    <who name="Dean Jackson">dino</who>
    <bug_when>2013-10-10 15:10:40 -0700</bug_when>
    <thetext>Comment on attachment 213923
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=213923&amp;action=review

&gt; Source/WebCore/html/canvas/WebGLRenderingContext.cpp:4170
&gt; +        for (unsigned ii = 0; ii &lt; v-&gt;length(); ++ii) {

Is there a reason for ii vs i here?

&gt; Source/WebCore/html/canvas/WebGLRenderingContext.cpp:4171
&gt; +            if (((GC3Dint*)v)[ii] &gt;= (int)m_textureUnits.size()) {

Might as well use static_cast

&gt; Source/WebCore/html/canvas/WebGLRenderingContext.cpp:4189
&gt; +    if (location-&gt;type() == GraphicsContext3D::SAMPLER_2D || location-&gt;type() == GraphicsContext3D::SAMPLER_CUBE)
&gt; +        for (unsigned ii = 0; ii &lt; (unsigned)size; ++ii) {
&gt; +            if (((GC3Dint*)v)[ii] &gt;= (int)m_textureUnits.size()) {

Same.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>938569</commentid>
    <comment_count>4</comment_count>
    <who name="Roger Fong">roger_fong</who>
    <bug_when>2013-10-10 15:19:23 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; (From update of attachment 213923 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=213923&amp;action=review
&gt; 
&gt; &gt; Source/WebCore/html/canvas/WebGLRenderingContext.cpp:4170
&gt; &gt; +        for (unsigned ii = 0; ii &lt; v-&gt;length(); ++ii) {
&gt; 
&gt; Is there a reason for ii vs i here?
Eh, just saw it in a number of places in the file. There are also plenty of just i&apos;s though. I can change.

&gt; 
&gt; &gt; Source/WebCore/html/canvas/WebGLRenderingContext.cpp:4171
&gt; &gt; +            if (((GC3Dint*)v)[ii] &gt;= (int)m_textureUnits.size()) {
&gt; 
&gt; Might as well use static_cast
&gt; 
&gt; &gt; Source/WebCore/html/canvas/WebGLRenderingContext.cpp:4189
&gt; &gt; +    if (location-&gt;type() == GraphicsContext3D::SAMPLER_2D || location-&gt;type() == GraphicsContext3D::SAMPLER_CUBE)
&gt; &gt; +        for (unsigned ii = 0; ii &lt; (unsigned)size; ++ii) {
&gt; &gt; +            if (((GC3Dint*)v)[ii] &gt;= (int)m_textureUnits.size()) {
&gt; 
&gt; Same.

KK</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>938605</commentid>
    <comment_count>5</comment_count>
    <who name="Roger Fong">roger_fong</who>
    <bug_when>2013-10-10 16:33:54 -0700</bug_when>
    <thetext>Committed with fixes: http://trac.webkit.org/changeset/157271</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>213923</attachid>
            <date>2013-10-10 13:33:38 -0700</date>
            <delta_ts>2013-10-10 15:10:40 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-122610-20131010133338.patch</filename>
            <type>text/plain</type>
            <size>2934</size>
            <attacher name="Roger Fong">roger_fong</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDE1NzI0NykKKysrIFNvdXJjZS9XZWJDb3JlL0NoYW5n
ZUxvZwkod29ya2luZyBjb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zRGludCopdilbaWldID49IChpbnQpbV90ZXh0dXJlVW5pdHMuc2l6ZSgpKSB7CisgICAg
ICAgICAgICAgICAgc3ludGhlc2l6ZUdMRXJyb3IoR3JhcGhpY3NDb250ZXh0M0Q6OklOVkFMSURf
VkFMVUUsICJ1bmlmb3JtMWkiLCAiaW52YWxpZCB0ZXh0dXJlIHVuaXQiKTsKKyAgICAgICAgICAg
ICAgICByZXR1cm47CisgICAgICAgICAgICB9CisgICAgICAgIH0KKwogICAgIG1fY29udGV4dC0+
dW5pZm9ybTFpdihsb2NhdGlvbi0+bG9jYXRpb24oKSwgc2l6ZSwgdik7CiAgICAgY2xlYW51cEFm
dGVyR3JhcGhpY3NDYWxsKGZhbHNlKTsKIH0K
</data>
<flag name="review"
          id="236374"
          type_id="1"
          status="+"
          setter="dino"
    />
          </attachment>
      

    </bug>

</bugzilla>