<?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>211942</bug_id>
          
          <creation_ts>2020-05-15 01:31:19 -0700</creation_ts>
          <short_desc>[GTK][WPE] webgl/1.0.3/conformance/more/functions/copyTexImage2DBadArgs.html is crashing</short_desc>
          <delta_ts>2022-09-29 12:41:18 -0700</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>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=211887</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Diego Pino">dpino</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>alex</cc>
    
    <cc>clord</cc>
    
    <cc>dino</cc>
    
    <cc>kbr</cc>
    
    <cc>magomez</cc>
    
    <cc>michal.kobylecki</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zdobersek</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1652981</commentid>
    <comment_count>0</comment_count>
    <who name="Diego Pino">dpino</who>
    <bug_when>2020-05-15 01:31:19 -0700</bug_when>
    <thetext>The test started crashing in r261023, together with other WebGL tests. This regression was partly fixed by r261609, but after r261609 this test is still crashing.

Crash-log: https://build.webkit.org/results/WPE%20Linux%2064-bit%20Release%20(Tests)/r261729%20(18186)/webgl/1.0.3/conformance/more/functions/copyTexImage2DBadArgs-crash-log.txt


Thread 1 (Thread 0x7f32608d4100 (LWP 13895)):
#0  0x00007f326aece87e in WTFCrash () at /app/webkit/WebKitBuild/Release/lib/libWPEWebKit-1.0.so.3
#1  0x00007f3268c2be35 in  () at /app/webkit/WebKitBuild/Release/lib/libWPEWebKit-1.0.so.3
#2  0x00007f3268c1fe1c in WebCore::WebGLRenderingContextBase::copyTexImage2D(unsigned int, int, unsigned int, int, int, int, int, int) () at /app/webkit/WebKitBuild/Release/lib/libWPEWebKit-1.0.so.3
#3  0x00007f3268245071 in WebCore::jsWebGLRenderingContextPrototypeFunctionCopyTexImage2DBody(JSC::JSGlobalObject*, JSC::CallFrame*, WebCore::JSWebGLRenderingContext*, JSC::ThrowScope&amp;) () at /app/webkit/WebKitBuild/Release/lib/libWPEWebKit-1.0.so.3
#4  0x00007f326824943b in WebCore::jsWebGLRenderingContextPrototypeFunctionCopyTexImage2D(JSC::JSGlobalObject*, JSC::CallFrame*) () at /app/webkit/WebKitBuild/Release/lib/libWPEWebKit-1.0.so.3
#5  0x00007f321feff178 in  ()
#6  0x00007ffd4866d5f0 in  ()
#7  0x00007f326acb7371 in llint_op_call_varargs () at /app/webkit/WebKitBuild/Release/lib/libWPEWebKit-1.0.so.3
#8  0x0000000000000000 in  ()

STDERR: 1   0x7f326aece879 WTFCrash
STDERR: 2   0x7f3268c2be35 /app/webkit/WebKitBuild/Release/lib/libWPEWebKit-1.0.so.3(+0x390ae35) [0x7f3268c2be35]
STDERR: 3   0x7f3268c1fe1c WebCore::WebGLRenderingContextBase::copyTexImage2D(unsigned int, int, unsigned int, int, int, int, int, int)
STDERR: 4   0x7f3268245071 /app/webkit/WebKitBuild/Release/lib/libWPEWebKit-1.0.so.3(+0x2f24071) [0x7f3268245071]
STDERR: 5   0x7f326824943b WebCore::jsWebGLRenderingContextPrototypeFunctionCopyTexImage2D(JSC::JSGlobalObject*, JSC::CallFrame*)
STDERR: 6   0x7f321feff178 [0x7f321feff178]</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1652982</commentid>
    <comment_count>1</comment_count>
    <who name="Diego Pino">dpino</who>
    <bug_when>2020-05-15 01:39:34 -0700</bug_when>
    <thetext>I decided to create a new ticket for this failure, independently of https://bugs.webkit.org/show_bug.cgi?id=211887, since this crash happens on GTK and WPE.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1867933</commentid>
    <comment_count>2</comment_count>
      <attachid>459120</attachid>
    <who name="">michal.kobylecki</who>
    <bug_when>2022-05-10 08:35:09 -0700</bug_when>
    <thetext>Created attachment 459120
Fix for crashing copyTexImage2DBadArgs</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1867937</commentid>
    <comment_count>3</comment_count>
    <who name="">michal.kobylecki</who>
    <bug_when>2022-05-10 08:40:33 -0700</bug_when>
    <thetext>Hi,
do you plan to deliver a fix for this issue?
I&apos;ve come across it when running WebGL 1.0.3 tests on WPE 2.34.7.
The analysis showed the reason is missing handling of incorrect level value which in the case of copyTexImage2DBadArgs test is -1.
This further led to trying to access the vector element with index -1 and it ends up with a crash of course.
I&apos;ve worked out a potential fix (please see attached patch).
It seems like it worked like that in the past but level value validation was removed at some point (see https://github.com/WebKit/WebKit/commit/96238bc353a16de3a120ebe925ecea631e97abd2#diff-559cea90f946de8eaeb87bb35e630916000e561eb725964fef24b902630b380fL4745).

Thank you in advance.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1902135</commentid>
    <comment_count>4</comment_count>
    <who name="Alejandro G. Castro">alex</who>
    <bug_when>2022-09-29 12:40:47 -0700</bug_when>
    <thetext>After replacing the WebGL backend with ANGLE the crash is fixed. The gardening commit is:

https://commits.webkit.org/255008@main</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1902136</commentid>
    <comment_count>5</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-09-29 12:41:18 -0700</bug_when>
    <thetext>&lt;rdar://problem/100577689&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>459120</attachid>
            <date>2022-05-10 08:35:09 -0700</date>
            <delta_ts>2022-05-10 08:35:09 -0700</delta_ts>
            <desc>Fix for crashing copyTexImage2DBadArgs</desc>
            <filename>copyTexImage2DBadArgs.patch</filename>
            <type>text/plain</type>
            <size>828</size>
            <attacher>michal.kobylecki</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJDb3JlL2h0bWwvY2FudmFzL1dlYkdMUmVuZGVyaW5nQ29u
dGV4dEJhc2UuY3BwIGIvU291cmNlL1dlYkNvcmUvaHRtbC9jYW52YXMvV2ViR0xSZW5kZXJpbmdD
b250ZXh0QmFzZS5jcHAKaW5kZXggYTc1YjVlODFlOTQ3Li45N2Y4M2I1OGMxNjQgMTAwNjQ0Ci0t
LSBhL1NvdXJjZS9XZWJDb3JlL2h0bWwvY2FudmFzL1dlYkdMUmVuZGVyaW5nQ29udGV4dEJhc2Uu
Y3BwCisrKyBiL1NvdXJjZS9XZWJDb3JlL2h0bWwvY2FudmFzL1dlYkdMUmVuZGVyaW5nQ29udGV4
dEJhc2UuY3BwCkBAIC01NTc0LDcgKzU1NzQsNyBAQCBib29sIFdlYkdMUmVuZGVyaW5nQ29udGV4
dEJhc2U6OnZhbGlkYXRlVGV4RnVuY1BhcmFtZXRlcnMoY29uc3QgY2hhciogZnVuY3Rpb25OYQog
ICAgICAgICBpZiAoIXZhbGlkYXRlVGV4SW1hZ2VTb3VyY2VGb3JtYXRBbmRUeXBlKGZ1bmN0aW9u
TmFtZSwgZnVuY3Rpb25UeXBlLCBpbnRlcm5hbGZvcm1hdCwgZm9ybWF0LCB0eXBlKSkKICAgICAg
ICAgICAgIHJldHVybiBmYWxzZTsKICAgICB9IGVsc2UgewotICAgICAgICBpZiAoIXZhbGlkYXRl
VGV4RnVuY0Zvcm1hdEFuZFR5cGUoZnVuY3Rpb25OYW1lLCBpbnRlcm5hbGZvcm1hdCwgZm9ybWF0
LCB0eXBlLCBsZXZlbCkpCisgICAgICAgIGlmICghdmFsaWRhdGVUZXhGdW5jRm9ybWF0QW5kVHlw
ZShmdW5jdGlvbk5hbWUsIGludGVybmFsZm9ybWF0LCBmb3JtYXQsIHR5cGUsIGxldmVsKSB8fCAh
dmFsaWRhdGVUZXhGdW5jTGV2ZWwoZnVuY3Rpb25OYW1lLCB0YXJnZXQsIGxldmVsKSkKICAgICAg
ICAgICAgIHJldHVybiBmYWxzZTsKICAgICB9CiAK
</data>

          </attachment>
      

    </bug>

</bugzilla>