Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround context leaking #189

Merged
merged 2 commits into from
Sep 15, 2016
Merged

Conversation

tstec
Copy link
Contributor

@tstec tstec commented Aug 4, 2016

In some situations CFMLParser mixes content of analyzed files. That's why we need to create separate instance of CFMLParser for each file.

In some situations CFMLParser mixes content of analyzed files. That's why we need to create separate instance of CFMLParser for each file.
@ryaneberly
Copy link
Contributor

This one is interesting, can you possible provide a code sample of it leaking?

@tstec
Copy link
Contributor Author

tstec commented Aug 16, 2016

I couldn't pinpoint set of classes that are responsible for this problem. This bug appear every time I do full project analyse and it's repeatable every time.

@ryaneberly
Copy link
Contributor

I added a reset() method to CFMLParser (cfparser 2.6.7), and added it to CFLint.fireStartedProcessing()

Can you try that and see if it fixes the issue.

@tstec
Copy link
Contributor Author

tstec commented Sep 6, 2016

Below are errors that occurred when I've executed code analysis with yours modifications.

Error 1.
Console is now full of analysed code, e.g.

INFO:   var redirectURL = (sslRedirection)?'https://':'http://';
INFO: redirectURL = cgi.server_name;
INFO: redirectURL = cgi.original_request_uri;
INFO:   if(len(trim(cgi.original_query_string)) )     {
INFO: redirectURL = '?';
INFO: redirectURL = cgi.original_query_string;
INFO:
INFO:     };

Previous version wasn't so verbose.

Error 2.
After some time StackOverflowError occurs. Before changes, full code analyse, have always finished successfully.

ERROR: Exception in thread "main" java.lang.StackOverflowError
ERROR:  at cfml.parsing.cfscript.CFMember.Decompile(CFMember.java:30)
ERROR:  at cfml.parsing.cfscript.CFFullVarExpression.Decompile(CFFullVarExpression.java:64)
ERROR:  at cfml.parsing.cfscript.CFFunctionExpression.Decompile(CFFunctionExpression.java:50)
ERROR:  at cfml.parsing.cfscript.CFFullVarExpression.Decompile(CFFullVarExpression.java:64)
ERROR:  at cfml.parsing.cfscript.script.CFExpressionStatement.Decompile(CFExpressionStatement.java:17)
ERROR:  at cfml.parsing.cfscript.script.CFCompoundStatement.Decompile(CFCompoundStatement.java:54)
ERROR:  at cfml.parsing.cfscript.script.CFForInStatement.Decompile(CFForInStatement.java:35)
ERROR:  at cfml.parsing.cfscript.script.CFCompoundStatement.Decompile(CFCompoundStatement.java:54)
ERROR:  at cfml.parsing.cfscript.script.CFIfStatement.Decompile(CFIfStatement.java:35)
ERROR:  at cfml.parsing.cfscript.script.CFCompoundStatement.Decompile(CFCompoundStatement.java:54)
ERROR:  at cfml.parsing.cfscript.script.CFIfStatement.Decompile(CFIfStatement.java:35)
ERROR:  at cfml.parsing.cfscript.script.CFCompoundStatement.Decompile(CFCompoundStatement.java:54)
ERROR:  at cfml.parsing.cfscript.script.CFForInStatement.Decompile(CFForInStatement.java:35)
ERROR:  at cfml.parsing.cfscript.script.CFCompoundStatement.Decompile(CFCompoundStatement.java:54)
ERROR:  at cfml.parsing.cfscript.script.CFCompoundStatement.Decompile(CFCompoundStatement.java:54)
ERROR:  at cfml.parsing.cfscript.script.CFCompoundStatement.Decompile(CFCompoundStatement.java:54)
ERROR:  at cfml.parsing.cfscript.script.CFCompoundStatement.Decompile(CFCompoundStatement.java:54)
ERROR:  at cfml.parsing.cfscript.script.CFCompoundStatement.Decompile(CFCompoundStatement.java:54)

@ryaneberly
Copy link
Contributor

Interesting. I don't know what causes the additional logging. I will take a look at that, but you can merge the PR if you like. Thanks for contributing.

@tstec
Copy link
Contributor Author

tstec commented Sep 15, 2016

Thank you. I'll merge my change shortly.

# Conflicts:
#	src/main/java/com/cflint/CFLint.java
@tstec tstec merged commit c48f5e5 into cflint:master Sep 15, 2016
@tstec tstec deleted the fix-cfmlparser branch September 15, 2016 10:09
@ryaneberly
Copy link
Contributor

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants