<?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>158437</bug_id>
          
          <creation_ts>2016-06-06 15:28:26 -0700</creation_ts>
          <short_desc>octal and binary parsing is wrong for some programs</short_desc>
          <delta_ts>2016-06-06 20:00:40 -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>JavaScriptCore</component>
          <version>WebKit Local 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="Saam Barati">saam</reporter>
          <assigned_to name="Michael Saboff">msaboff</assigned_to>
          <cc>benjamin</cc>
    
    <cc>fpizlo</cc>
    
    <cc>ggaren</cc>
    
    <cc>gskachkov</cc>
    
    <cc>keith_miller</cc>
    
    <cc>mark.lam</cc>
    
    <cc>msaboff</cc>
    
    <cc>oliver</cc>
    
    <cc>sukolsak</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1199732</commentid>
    <comment_count>0</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2016-06-06 15:28:26 -0700</bug_when>
    <thetext>olliej is the one who found this.

eval(“0o19”)
crashes in a debug build:

ASSERTION FAILED: !isImpureNaN(d)
/Volumes/Untitled/WebKit/WebKit/Source/JavaScriptCore/runtime/JSCJSValueInlines.h(475) : JSC::JSValue::JSValue(JSC::JSValue::EncodeAsDoubleTag, double)
1   0x106323dcd WTFCrash
2   0x105486357 JSC::JSValue::JSValue(JSC::JSValue::EncodeAsDoubleTag, double)
3   0x1054862f5 JSC::JSValue::JSValue(JSC::JSValue::EncodeAsDoubleTag, double)
4   0x10567f0dc JSC::JSValue::JSValue(double)
5   0x10567f03f JSC::JSValue::JSValue(double)
6   0x105ffff9d JSC::NumberNode::NumberNode(JSC::JSTokenLocation const&amp;, double)
7   0x105fffed1 JSC::DoubleNode::DoubleNode(JSC::JSTokenLocation const&amp;, double)
8   0x106000447 JSC::DoubleNode::DoubleNode(JSC::JSTokenLocation const&amp;, double)
9   0x106018f5e JSC::ASTBuilder::createDoubleExpr(JSC::JSTokenLocation const&amp;, double)
10  0x10601327a JSC::ASTBuilder::Expression JSC::Parser&lt;JSC::Lexer&lt;unsigned char&gt; &gt;::parsePrimaryExpression&lt;JSC::ASTBuilder&gt;(JSC::ASTBuilder&amp;)
11  0x1060114b6 JSC::ASTBuilder::Expression JSC::Parser&lt;JSC::Lexer&lt;unsigned char&gt; &gt;::parseMemberExpression&lt;JSC::ASTBuilder&gt;(JSC::ASTBuilder&amp;)
12  0x1060509ea JSC::ASTBuilder::Expression JSC::Parser&lt;JSC::Lexer&lt;unsigned char&gt; &gt;::parseUnaryExpression&lt;JSC::ASTBuilder&gt;(JSC::ASTBuilder&amp;)
13  0x10604ffea JSC::ASTBuilder::Expression JSC::Parser&lt;JSC::Lexer&lt;unsigned char&gt; &gt;::parseBinaryExpression&lt;JSC::ASTBuilder&gt;(JSC::ASTBuilder&amp;)
14  0x10604f419 JSC::ASTBuilder::Expression JSC::Parser&lt;JSC::Lexer&lt;unsigned char&gt; &gt;::parseConditionalExpression&lt;JSC::ASTBuilder&gt;(JSC::ASTBuilder&amp;)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1199742</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2016-06-06 15:51:56 -0700</bug_when>
    <thetext>I don&apos;t get this crash with a debug build of ToT (r201731):

$ DYLD_FRAMEWORK_PATH=WebKitBuild/Debug WebKitBuild/Debug/jsc 
&gt;&gt;&gt; eval(&quot;0o19&quot;)
Exception: SyntaxError: Unexpected number &apos;9&apos;. Parse error.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1199772</commentid>
    <comment_count>2</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2016-06-06 16:34:59 -0700</bug_when>
    <thetext>It would appear that this is somehow machine dependent. What joy :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1199783</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2016-06-06 16:57:10 -0700</bug_when>
    <thetext>Turns out that the issue is reading uninitialized memory.  Thus the machine dependent failure.  Bad binary literals have the same issue.  Patch in the works.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1199812</commentid>
    <comment_count>4</comment_count>
      <attachid>280656</attachid>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2016-06-06 17:59:21 -0700</bug_when>
    <thetext>Created attachment 280656
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1199813</commentid>
    <comment_count>5</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2016-06-06 17:59:53 -0700</bug_when>
    <thetext>&lt;rdar://problem/26663732&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1199838</commentid>
    <comment_count>6</comment_count>
      <attachid>280656</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2016-06-06 18:48:18 -0700</bug_when>
    <thetext>Comment on attachment 280656
Patch

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

&gt; Source/JavaScriptCore/ChangeLog:9
&gt; +        When there is an error parsing an binary or octal literal, we need to clear the returnValue
&gt; +        of any residual value.

Why?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1199849</commentid>
    <comment_count>7</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2016-06-06 19:38:13 -0700</bug_when>
    <thetext>(In reply to comment #6)
&gt; Comment on attachment 280656 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=280656&amp;action=review
&gt; 
&gt; &gt; Source/JavaScriptCore/ChangeLog:9
&gt; &gt; +        When there is an error parsing an binary or octal literal, we need to clear the returnValue
&gt; &gt; +        of any residual value.
&gt; 
&gt; Why?

Because returnValue&apos;s value is used to determine INTEGER or DOUBLE token type.  If the value is a double and an impure NaN we get the crash.  The syntax checking is based on having leftover characters and is done after the returnValue has been processed.

I&apos;ll add some of that detail to the ChangeLog.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1199860</commentid>
    <comment_count>8</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2016-06-06 20:00:40 -0700</bug_when>
    <thetext>Committed r201737: &lt;http://trac.webkit.org/changeset/201737&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>280656</attachid>
            <date>2016-06-06 17:59:21 -0700</date>
            <delta_ts>2016-06-06 18:30:35 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>158437.patch</filename>
            <type>text/plain</type>
            <size>2174</size>
            <attacher name="Michael Saboff">msaboff</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cKPT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gU291
cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkocmV2aXNpb24gMjAxNzM0KQorKysgU291cmNl
L0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzIC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PT09PT09PT09PT09PT09PT09PT09PQotLS0g
U291cmNlL0phdmFTY3JpcHRDb3JlL3Rlc3RzL3N0cmVzcy9yZWdyZXNzLTE1ODQzNy5qcwkocmV2
aXNpb24gMCkKKysrIFNvdXJjZS9KYXZhU2NyaXB0Q29yZS90ZXN0cy9zdHJlc3MvcmVncmVzcy0x
NTg0MzcuanMJKHdvcmtpbmcgY29weSkKQEAgLTAsMCArMSwxMSBAQAorLy8gVGhpcyB0ZXN0IHNo
b3VsZCBub3QgY3Jhc2guCisKK3RyeSB7CisgICAgbGV0IHggPSBldmFsKCIwbzE5Iik7Cit9IGNh
dGNoKGUpIHsKK30KKwordHJ5IHsKKyAgICBsZXQgeCA9IGV2YWwoIjBiMTkiKTsKK30gY2F0Y2go
ZSkgeworfQo=
</data>
<flag name="review"
          id="304554"
          type_id="1"
          status="+"
          setter="saam"
    />
          </attachment>
      

    </bug>

</bugzilla>