diff --git a/pmd-plsql/etc/grammar/PldocAST.jjt b/pmd-plsql/etc/grammar/PldocAST.jjt index 723e831d25..b48397094e 100644 --- a/pmd-plsql/etc/grammar/PldocAST.jjt +++ b/pmd-plsql/etc/grammar/PldocAST.jjt @@ -917,6 +917,8 @@ void Skip2NextTerminator(String initiator,String terminator) : t = getToken(1); if(t.image.equals(initiator)) count++; if(t.image.equals(terminator)) count--; + if(null != t.specialToken || t.kind == EOF) + return; } } { diff --git a/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/PLSQLParserTest.java b/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/PLSQLParserTest.java index c4301ef41e..07120bfee9 100644 --- a/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/PLSQLParserTest.java +++ b/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/PLSQLParserTest.java @@ -36,4 +36,12 @@ public class PLSQLParserTest extends AbstractPLSQLParserTst { + " doSomethingElse;" + "END;"); } + + @Test(timeout = 5000) + public void testBug1531() { + parsePLSQL( + "create or replace force view oxa.o_xa_function_role_types as\n" + + "select \"CFT_ID\",\"CFR_ID\",\"CFT_NAME\",\"TCN\",\"LOG_MODULE\",\"LOG_USER\",\"LOG_DATE\",\"LOG_TIME\" from crm_function_role_types\n" + + "/"); + } } diff --git a/src/site/markdown/overview/changelog.md b/src/site/markdown/overview/changelog.md index 7ae7fa6535..78ce1383ff 100644 --- a/src/site/markdown/overview/changelog.md +++ b/src/site/markdown/overview/changelog.md @@ -23,6 +23,7 @@ * [#116](https://github.com/pmd/pmd/pull/116): \[core] \[java] Improve collection usage * [#117](https://github.com/pmd/pmd/pull/117): \[java] Improve symboltable performance * [#118](https://github.com/pmd/pmd/pull/118): \[java] Simplify VariableDeclaratorId parsing +* [#119](https://github.com/pmd/pmd/pull/119): \[plsql] Fix PMD issue 1531- endless loop followed by OOM while parsing (PL)SQL **Bugfixes:** @@ -41,6 +42,8 @@ * [#1534](https://sourceforge.net/p/pmd/bugs/1534/): \[java] CloneMethodMustImplementCloneable: ClassCastException with Annotation (java8) * java-typeresolution/SignatureDeclareThrowsException * [#1535](https://sourceforge.net/p/pmd/bugs/1535/): \[java] SignatureDeclareThrowsException: ClassCastException with Annotation +* PLSQL + * [#1531](https://sourceforge.net/p/pmd/bugs/1531/): \[plsql] OOM/Endless loop while parsing (PL)SQL * General * [#1506](https://sourceforge.net/p/pmd/bugs/1506/): \[core] When runing any RuleTst, start/end methods not called * [#1517](https://sourceforge.net/p/pmd/bugs/1517/): \[java] CPD reports on Java constructors when using ignoreIdentifiers