Nicely done :) and fixed
I'm wondering how many versions you have lol. Is this a windmill war or can I win? Maybe server side regexes with lookbehind would be better or a client side parser
------------------------------------------------------------------------------------------------------------
"People who say it cannot be done should not interrupt those who are doing it.";
labs : [www.businessinfo.co.uk]
blog : [www.thespanner.co.uk]
Hackvertor : [hackvertor.co.uk]
Ok one last attempt, I completely rewrite regexes into a JSREG function so /a/ becomes JSREG_R('a')
------------------------------------------------------------------------------------------------------------
"People who say it cannot be done should not interrupt those who are doing it.";
labs : [www.businessinfo.co.uk]
blog : [www.thespanner.co.uk]
Hackvertor : [hackvertor.co.uk]
Me too, damn I don't want to see 2.0 lol you'll make me cry
------------------------------------------------------------------------------------------------------------
"People who say it cannot be done should not interrupt those who are doing it.";
labs : [www.businessinfo.co.uk]
blog : [www.thespanner.co.uk]
Hackvertor : [hackvertor.co.uk]
E4x strikes again. Ugh. Removed all nodes. If anyone know how to disable e4x with js I'd appreciate it if you let me know.
------------------------------------------------------------------------------------------------------------
"People who say it cannot be done should not interrupt those who are doing it.";
labs : [www.businessinfo.co.uk]
blog : [www.thespanner.co.uk]
Hackvertor : [hackvertor.co.uk]
------------------------------------------------------------------------------------------------------------
"People who say it cannot be done should not interrupt those who are doing it.";
labs : [www.businessinfo.co.uk]
blog : [www.thespanner.co.uk]
Hackvertor : [hackvertor.co.uk]
Yeah I know :( it was very quick and very dirty lol
Not much better I know:-
e4x = /(?:<\w*>(?:.|[\f\n\r\u000b\u2028\u2029])*<\/\w*>|<\w+(?:.|[\f\n\r\u000b\u2028\u2029])*\/>)/,
------------------------------------------------------------------------------------------------------------
"People who say it cannot be done should not interrupt those who are doing it.";
labs : [www.businessinfo.co.uk]
blog : [www.thespanner.co.uk]
Hackvertor : [hackvertor.co.uk]
Edited 1 time(s). Last edit at 03/30/2011 12:32PM by Gareth Heyes.
There's no chance I can match e4x without a parser =) I need to find a way to disable it.
------------------------------------------------------------------------------------------------------------
"People who say it cannot be done should not interrupt those who are doing it.";
labs : [www.businessinfo.co.uk]
blog : [www.thespanner.co.uk]
Hackvertor : [hackvertor.co.uk]
Thanks! I broke the syntax check, should detect it now
------------------------------------------------------------------------------------------------------------
"People who say it cannot be done should not interrupt those who are doing it.";
labs : [www.businessinfo.co.uk]
blog : [www.thespanner.co.uk]
Hackvertor : [hackvertor.co.uk]
I wanna thank you for being awesome xD shame you were late to the party though :) JSReg is broken in so many places now! :) a huge challenge to fix thanks
------------------------------------------------------------------------------------------------------------
"People who say it cannot be done should not interrupt those who are doing it.";
labs : [www.businessinfo.co.uk]
blog : [www.thespanner.co.uk]
Hackvertor : [hackvertor.co.uk]
Anyways I've added e4x detection and now jsreg doesn't allow it. Also fixed lever_one's regex vector
------------------------------------------------------------------------------------------------------------
"People who say it cannot be done should not interrupt those who are doing it.";
labs : [www.businessinfo.co.uk]
blog : [www.thespanner.co.uk]
Hackvertor : [hackvertor.co.uk]
------------------------------------------------------------------------------------------------------------
"People who say it cannot be done should not interrupt those who are doing it.";
labs : [www.businessinfo.co.uk]
blog : [www.thespanner.co.uk]
Hackvertor : [hackvertor.co.uk]
Ok I'm back with a bloody nose but still standing (just)
I've completely re-factored the rewriter to handle different states. The regex is handled by a small state machine to fix lax browser parsers and stop bad syntax inside regex character classes. I also detect E4X and prevent it from being executed.
I really appreciate all your help thanks! Please break me again :D this time I should be better prepared for the battle
------------------------------------------------------------------------------------------------------------
"People who say it cannot be done should not interrupt those who are doing it.";
labs : [www.businessinfo.co.uk]
blog : [www.thespanner.co.uk]
Hackvertor : [hackvertor.co.uk]
Whenever I try to use the "in" or "instanceof" operator I get:
ReferenceError: rewriteinInstanceofOperator is not defined
Ok, I'll add these as well. A more comprehensive list than I tweeted:
Bypasses:
_:/\[/+alert(top)/i
{}/\[/+alert(top)/i
typeof/\[/+alert(top)/i
0?0:/\[/+alert(top)/i
delete/\[/+alert(top)/i
void/\[/+alert(top)/i
with({})/\[/+alert(top)/i
if(1)/\[/+alert(top)/i
while(1)/\[/+alert(top)/i -- Careful with this one
try{/\[/+alert(top)/i}catch(a){}
throw/\[/+alert(top)/i
(function(){return/\[/+alert(top)/i})()
do{/\[/+alert(top)/i}while(1)
switch(0){case 0:/\[/+alert(top)/i}
_:/(]\[)/+alert(top)//]
_:/'/+alert(top)/i
_:<{'x'}>'</x>+alert(top)//'
_:/{/;alert(top)//
_:/\(/;alert(top)//
_:/ /+alert(top)//
Endless loops:
_:/\[/
_:/'/
_:/(]\[)/
_:/ / /**/
The common problem in all these cases is that the first / is interpreted as division instead of regexp. The prefixes are incorrectly interpreted as the first operand of the division.
Overall there has been fantastic improvement on the regexps (as long as they are identified as such)! Great work Gaz!
Took slightly longer to fix because lever_one pointed out that I need to track statements with his vector. Jonas I forgot to add the left flag for statements for your bugs =) oooops fixed
------------------------------------------------------------------------------------------------------------
"People who say it cannot be done should not interrupt those who are doing it.";
labs : [www.businessinfo.co.uk]
blog : [www.thespanner.co.uk]
Hackvertor : [hackvertor.co.uk]
Those IE ones are outstanding! :D that isn't even a bug in JSReg :) IE is doing crazy things there. For the first one I need to track { and } to determine if it's a block statement or object literal.
Update....
and fixed! I check for empty character classes and track opening and closing curlys to determine a block statement or object literal.
------------------------------------------------------------------------------------------------------------
"People who say it cannot be done should not interrupt those who are doing it.";
labs : [www.businessinfo.co.uk]
blog : [www.thespanner.co.uk]
Hackvertor : [hackvertor.co.uk]
Edited 1 time(s). Last edit at 05/01/2011 07:29PM by Gareth Heyes.