
Safari Accidentally Treating ';' as an Assignment Operator - fagnerbrack
https://bugs.webkit.org/show_bug.cgi?id=176114
======
sillysaurus3
_LiteralParser is used for JSON and for JSONP.

To do JSONP quickly we have magic logic to handle

(a(.b)_=json | a(.b) _\\(json\\))+

which we parse and call directly to avoid jumping through the interpreter. We
need this because people still insist on sending megs of data as executable
script. because reasons._

This is hilarious.

 _> This code looks suspicious inside the lex() function:

    
    
             if (*m_ptr == ';') {
                 token.type = TokSemi;
                 token.end = ++m_ptr;
                 return TokAssign;
             }
    

that does indeed seem questionable. I'm so sad I wrote it :(_

Know that feeling.

~~~
wahern
Part of the patch does

    
    
      -    return TokAssign;
      +    return TokSemi;
    

but that commits the same original sin. The better fix is

    
    
      +    return token.type;
    

OTOH, if _all_ the other code were using the same poor pattern I could
understand not wanting to fix it properly, at least in an initial patch.

------
fagnerbrack
Relevant
[https://twitter.com/RReverser/status/902504540393660416](https://twitter.com/RReverser/status/902504540393660416)

