<?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>235348</bug_id>
          
          <creation_ts>2022-01-18 22:51:23 -0800</creation_ts>
          <short_desc>[JSC] Fix YarrJIT backtrackCharacterClassNonGreedy breakpoint</short_desc>
          <delta_ts>2022-01-19 11:53:54 -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>New Bugs</component>
          <version>WebKit 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>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Yusuke Suzuki">ysuzuki</reporter>
          <assigned_to name="Yusuke Suzuki">ysuzuki</assigned_to>
          <cc>darin</cc>
    
    <cc>ews-watchlist</cc>
    
    <cc>keith_miller</cc>
    
    <cc>mark.lam</cc>
    
    <cc>msaboff</cc>
    
    <cc>saam</cc>
    
    <cc>tzagallo</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1831946</commentid>
    <comment_count>0</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2022-01-18 22:51:23 -0800</bug_when>
    <thetext>[JSC] Fix YarrJIT backtrackCharacterClassNonGreedy breakpoint</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1831947</commentid>
    <comment_count>1</comment_count>
      <attachid>449465</attachid>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2022-01-18 22:57:59 -0800</bug_when>
    <thetext>Created attachment 449465
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1831948</commentid>
    <comment_count>2</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2022-01-18 22:58:18 -0800</bug_when>
    <thetext>rdar://84108897</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1832045</commentid>
    <comment_count>3</comment_count>
      <attachid>449465</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2022-01-19 08:53:13 -0800</bug_when>
    <thetext>Comment on attachment 449465
Patch

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

&gt; Source/JavaScriptCore/yarr/YarrJIT.cpp:2062
&gt; +            m_jit.sub32(MacroAssembler::TrustedImm32(1), m_regs.index);

Do we need anything different in the m_decodeSurrogatePairs case? In that case it might be incremented my more than one?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1832056</commentid>
    <comment_count>4</comment_count>
      <attachid>449465</attachid>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2022-01-19 09:37:09 -0800</bug_when>
    <thetext>Comment on attachment 449465
Patch

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

&gt;&gt; Source/JavaScriptCore/yarr/YarrJIT.cpp:2062
&gt;&gt; +            m_jit.sub32(MacroAssembler::TrustedImm32(1), m_regs.index);
&gt; 
&gt; Do we need anything different in the m_decodeSurrogatePairs case? In that case it might be incremented my more than one?

nonGreedyFailuresDecrementIndex is added only when m_decodeSurrogatePairs is true. So, this path will be taken only when m_decodeSurrogatePairs is true case. (nonGreedyFailuresDecrementIndex is added in L2052, which is executed when m_decodeSurrogatePairs is true).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1832058</commentid>
    <comment_count>5</comment_count>
      <attachid>449465</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2022-01-19 09:46:00 -0800</bug_when>
    <thetext>Comment on attachment 449465
Patch

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

&gt;&gt;&gt; Source/JavaScriptCore/yarr/YarrJIT.cpp:2062
&gt;&gt;&gt; +            m_jit.sub32(MacroAssembler::TrustedImm32(1), m_regs.index);
&gt;&gt; 
&gt;&gt; Do we need anything different in the m_decodeSurrogatePairs case? In that case it might be incremented my more than one?
&gt; 
&gt; nonGreedyFailuresDecrementIndex is added only when m_decodeSurrogatePairs is true. So, this path will be taken only when m_decodeSurrogatePairs is true case. (nonGreedyFailuresDecrementIndex is added in L2052, which is executed when m_decodeSurrogatePairs is true).

OK, maybe I can’t review then, because I can’t spot the add32 that this subtract is reversing, so I suppose you need a review from a subject matter expert. Sorry, I was hoping I could save a little time by being your reviewer!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1832081</commentid>
    <comment_count>6</comment_count>
      <attachid>449465</attachid>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2022-01-19 10:39:20 -0800</bug_when>
    <thetext>Comment on attachment 449465
Patch

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

&gt;&gt;&gt;&gt; Source/JavaScriptCore/yarr/YarrJIT.cpp:2062
&gt;&gt;&gt;&gt; +            m_jit.sub32(MacroAssembler::TrustedImm32(1), m_regs.index);
&gt;&gt;&gt; 
&gt;&gt;&gt; Do we need anything different in the m_decodeSurrogatePairs case? In that case it might be incremented my more than one?
&gt;&gt; 
&gt;&gt; nonGreedyFailuresDecrementIndex is added only when m_decodeSurrogatePairs is true. So, this path will be taken only when m_decodeSurrogatePairs is true case. (nonGreedyFailuresDecrementIndex is added in L2052, which is executed when m_decodeSurrogatePairs is true).
&gt; 
&gt; OK, maybe I can’t review then, because I can’t spot the add32 that this subtract is reversing, so I suppose you need a review from a subject matter expert. Sorry, I was hoping I could save a little time by being your reviewer!

np!!!!! Thank you for your review :D</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1832102</commentid>
    <comment_count>7</comment_count>
      <attachid>449465</attachid>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2022-01-19 11:22:46 -0800</bug_when>
    <thetext>Comment on attachment 449465
Patch

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

r=me

&gt;&gt;&gt;&gt;&gt; Source/JavaScriptCore/yarr/YarrJIT.cpp:2062
&gt;&gt;&gt;&gt;&gt; +            m_jit.sub32(MacroAssembler::TrustedImm32(1), m_regs.index);
&gt;&gt;&gt;&gt; 
&gt;&gt;&gt;&gt; Do we need anything different in the m_decodeSurrogatePairs case? In that case it might be incremented my more than one?
&gt;&gt;&gt; 
&gt;&gt;&gt; nonGreedyFailuresDecrementIndex is added only when m_decodeSurrogatePairs is true. So, this path will be taken only when m_decodeSurrogatePairs is true case. (nonGreedyFailuresDecrementIndex is added in L2052, which is executed when m_decodeSurrogatePairs is true).
&gt;&gt; 
&gt;&gt; OK, maybe I can’t review then, because I can’t spot the add32 that this subtract is reversing, so I suppose you need a review from a subject matter expert. Sorry, I was hoping I could save a little time by being your reviewer!
&gt; 
&gt; np!!!!! Thank you for your review :D

This is safe and appropriate because we only get in this case when the following is true (from reading L2050-2063 and L516-520):
 1) We are in the m_decodeSurrogatePairs case.
 2) We are trying to match a non-BMP character.
 3) We are at the end of the string input with the first of the two characters, i.e. we have incremented 1.
 4) There we can&apos;t advance the index for the second character we can&apos;t read.
Therefore we need to decrement index by 1 and fall through to the failed non-greedy match.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1832106</commentid>
    <comment_count>8</comment_count>
      <attachid>449465</attachid>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2022-01-19 11:27:12 -0800</bug_when>
    <thetext>Comment on attachment 449465
Patch

Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1832125</commentid>
    <comment_count>9</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2022-01-19 11:53:50 -0800</bug_when>
    <thetext>Committed r288224 (246184@main): &lt;https://commits.webkit.org/246184@main&gt;

All reviewed patches have been landed. Closing bug and clearing flags on attachment 449465.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>449465</attachid>
            <date>2022-01-18 22:57:59 -0800</date>
            <delta_ts>2022-01-19 11:53:53 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-235348-20220118225758.patch</filename>
            <type>text/plain</type>
            <size>2877</size>
            <attacher name="Yusuke Suzuki">ysuzuki</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjg4MTY0CmRpZmYgLS1naXQgYS9Tb3VyY2UvSmF2YVNjcmlw
dENvcmUvQ2hhbmdlTG9nIGIvU291cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwppbmRleCBm
NmEzMDhkN2MzZDEzMzg5YjgyNDA1YzJhNjE5YzBhZDc2ZmM5MjU4Li5iODA1NDJiYWQwZGM2MWQ2
MTgyNDAyOWM4MGI5OTRmNTMwZWUzNzE5IDEwMDY0NAotLS0gYS9Tb3VyY2UvSmF2YVNjcmlwdENv
cmUvQ2hhbmdlTG9nCisrKyBiL1NvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cKQEAgLTEs
MyArMSwxNSBAQAorMjAyMi0wMS0xOCAgWXVzdWtlIFN1enVraSAgPHlzdXp1a2lAYXBwbGUuY29t
PgorCisgICAgICAgIFtKU0NdIEZpeCBZYXJySklUIGJhY2t0cmFja0NoYXJhY3RlckNsYXNzTm9u
R3JlZWR5IGJyZWFrcG9pbnQKKyAgICAgICAgaHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19i
dWcuY2dpP2lkPTIzNTM0OAorCisgICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAoT09QUyEpLgor
CisgICAgICAgIFlhcnJKSVQncyBiYWNrdHJhY2tDaGFyYWN0ZXJDbGFzc05v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