changeset 2002:6e9f5f2c620a jdk8u242-b01

Merge
author andrew
date Thu, 17 Oct 2019 13:47:18 +0100
parents 187f73676840 (current diff) f12bc79922f2 (diff)
children 91cff4cef209
files .hgtags
diffstat 8 files changed, 83 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Sep 12 15:21:44 2019 -0400
+++ b/.hgtags	Thu Oct 17 13:47:18 2019 +0100
@@ -1011,3 +1011,8 @@
 cf6d611731058013acb5d3c1d3d123640289cbf9 jdk8u232-b04
 2b9fdc450085129df45fff7c8d6604b6277b48c5 jdk8u232-b05
 7b44b5f468a471559b948c0672c6ab028968dccf jdk8u242-b00
+be814fbd44e0803938cc6b6c600e4075ca3bdc9c jdk8u232-b06
+0a5bd84fd43f074e58bb00117183e59f5e8a0595 jdk8u232-b07
+764618a906e860888dc1fae5212d43be7abac4af jdk8u232-b08
+6f9c0c731ab72a0f6e4085a0db9594e891de5e4f jdk8u232-b09
+6f9c0c731ab72a0f6e4085a0db9594e891de5e4f jdk8u232-ga
--- a/THIRD_PARTY_README	Thu Sep 12 15:21:44 2019 -0400
+++ b/THIRD_PARTY_README	Thu Oct 17 13:47:18 2019 +0100
@@ -2130,13 +2130,13 @@
 
 -------------------------------------------------------------------------------
 
-%% This notice is provided with respect to PC/SC Lite for Suse Linux v.1.1.1,
+%% This notice is provided with respect to PC/SC Lite v1.8.24,
 which may be included with JRE 8, JDK 8, and OpenJDK 8 on Linux and Solaris.
 
 --- begin of LICENSE ---
 
-Copyright (c) 1999-2004 David Corcoran <corcoran@linuxnet.com>
-Copyright (c) 1999-2004 Ludovic Rousseau <ludovic.rousseau (at) free.fr>
+Copyright (c) 1999-2003 David Corcoran <corcoran@linuxnet.com>
+Copyright (c) 2001-2011 Ludovic Rousseau <ludovic.rousseau@free.fr>
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -2148,15 +2148,10 @@
 2. Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.
-3. All advertising materials mentioning features or use of this software
-   must display the following acknowledgement:
-     This product includes software developed by: 
-      David Corcoran <corcoran@linuxnet.com>
-      http://www.linuxnet.com (MUSCLE)
-4. The name of the author may not be used to endorse or promote products
+3. The name of the author may not be used to endorse or promote products
    derived from this software without specific prior written permission.
 
-Changes to this license can be made only by the copyright author with 
+Changes to this license can be made only by the copyright author with
 explicit written consent.
 
 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- a/src/com/sun/org/apache/xpath/internal/XPath.java	Thu Sep 12 15:21:44 2019 -0400
+++ b/src/com/sun/org/apache/xpath/internal/XPath.java	Thu Oct 17 13:47:18 2019 +0100
@@ -3,7 +3,7 @@
  * DO NOT REMOVE OR ALTER!
  */
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2019 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -181,10 +181,12 @@
     else if (MATCH == type)
       parser.initMatchPattern(compiler, exprString, prefixResolver);
     else
-      throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_CANNOT_DEAL_XPATH_TYPE, new Object[]{Integer.toString(type)})); //"Can not deal with XPath type: " + type);
+      throw new RuntimeException(XSLMessages.createXPATHMessage(
+              XPATHErrorResources.ER_CANNOT_DEAL_XPATH_TYPE,
+              new Object[]{Integer.toString(type)}));
 
     // System.out.println("----------------");
-    Expression expr = compiler.compile(0);
+    Expression expr = compiler.compileExpression(0);
 
     // System.out.println("expr: "+expr);
     this.setExpression(expr);
@@ -236,7 +238,7 @@
             //"Can not deal with XPath type: " + type);
 
     // System.out.println("----------------");
-    Expression expr = compiler.compile(0);
+    Expression expr = compiler.compileExpression(0);
 
     // System.out.println("expr: "+expr);
     this.setExpression(expr);
--- a/src/com/sun/org/apache/xpath/internal/axes/FilterExprWalker.java	Thu Sep 12 15:21:44 2019 -0400
+++ b/src/com/sun/org/apache/xpath/internal/axes/FilterExprWalker.java	Thu Oct 17 13:47:18 2019 +0100
@@ -3,7 +3,7 @@
  * DO NOT REMOVE OR ALTER!
  */
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2019 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -75,7 +75,7 @@
         m_mustHardReset = true;
     case OpCodes.OP_GROUP :
     case OpCodes.OP_VARIABLE :
-      m_expr = compiler.compile(opPos);
+      m_expr = compiler.compileExpression(opPos);
       m_expr.exprSetParent(this);
       //if((OpCodes.OP_FUNCTION == stepType) && (m_expr instanceof com.sun.org.apache.xalan.internal.templates.FuncKey))
       if(m_expr instanceof com.sun.org.apache.xpath.internal.operations.Variable)
@@ -85,7 +85,7 @@
       }
       break;
     default :
-      m_expr = compiler.compile(opPos + 2);
+      m_expr = compiler.compileExpression(opPos + 2);
       m_expr.exprSetParent(this);
     }
 //    if(m_expr instanceof WalkingIterator)
--- a/src/com/sun/org/apache/xpath/internal/axes/WalkerFactory.java	Thu Sep 12 15:21:44 2019 -0400
+++ b/src/com/sun/org/apache/xpath/internal/axes/WalkerFactory.java	Thu Oct 17 13:47:18 2019 +0100
@@ -3,7 +3,7 @@
  * DO NOT REMOVE OR ALTER!
  */
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2019 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -1007,10 +1007,10 @@
       case OpCodes.OP_EXTFUNCTION :
       case OpCodes.OP_FUNCTION :
       case OpCodes.OP_GROUP :
-        expr = compiler.compile(opPos);
+        expr = compiler.compileExpression(opPos);
         break;
       default :
-        expr = compiler.compile(opPos + 2);
+        expr = compiler.compileExpression(opPos + 2);
       }
 
       axis = Axis.FILTEREDLIST;
--- a/src/com/sun/org/apache/xpath/internal/compiler/Compiler.java	Thu Sep 12 15:21:44 2019 -0400
+++ b/src/com/sun/org/apache/xpath/internal/compiler/Compiler.java	Thu Oct 17 13:47:18 2019 +0100
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
@@ -71,9 +70,12 @@
  * of operation codes (op map) and then builds from that into an Expression
  * tree.
  * @xsl.usage advanced
+ * @LastModified: May 2019
  */
 public class Compiler extends OpMap
 {
+  // count the number of operations or calls to compileOperation
+  int countOp;
 
   /**
    * Construct a Compiler object with a specific ErrorListener and
@@ -107,15 +109,40 @@
 
   /**
    * Execute the XPath object from a given opcode position.
+   *
+   * Note that this method is added so that when StackOverflowError is caught
+   * the address space can be freed to this point allowing further activities
+   * such as reporting the error.
+   *
    * @param opPos The current position in the xpath.m_opMap array.
    * @return The result of the XPath.
    *
    * @throws TransformerException if there is a syntax or other error.
    * @xsl.usage advanced
    */
-  public Expression compile(int opPos) throws TransformerException
+   public Expression compileExpression(int opPos) throws TransformerException
+   {
+       try {
+           countOp = 0;
+           return compile(opPos);
+       } catch (StackOverflowError sof) {
+           error(XPATHErrorResources.ER_COMPILATION_TOO_MANY_OPERATION, new Object[]{countOp});
+       }
+       return null;
+   }
+
+  /**
+   * This method handles the actual compilation process. It is called from the
+   * compileExpression method as well as the subsequent processes. See the note
+   * for compileExpression.
+   *
+   * @param opPos The current position in the xpath.m_opMap array.
+   * @return The result of the XPath.
+   *
+   * @throws TransformerException if there is a syntax or other error.
+   */
+  private Expression compile(int opPos) throws TransformerException
   {
-
     int op = getOp(opPos);
 
     Expression expr = null;
@@ -211,6 +238,7 @@
   private Expression compileOperation(Operation operation, int opPos)
           throws TransformerException
   {
+    ++countOp;
 
     int leftPos = getFirstChildPos(opPos);
     int rightPos = getNextOpPos(leftPos);
--- a/src/com/sun/org/apache/xpath/internal/compiler/XPathParser.java	Thu Sep 12 15:21:44 2019 -0400
+++ b/src/com/sun/org/apache/xpath/internal/compiler/XPathParser.java	Thu Oct 17 13:47:18 2019 +0100
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
@@ -37,6 +36,7 @@
  * Tokenizes and parses XPath expressions. This should really be named
  * XPathParserImpl, and may be renamed in the future.
  * @xsl.usage general
+ * @LastModified: May 2019
  */
 public class XPathParser
 {
@@ -74,6 +74,9 @@
   protected final static int FILTER_MATCH_PRIMARY    = 1;
   protected final static int FILTER_MATCH_PREDICATES = 2;
 
+  // counts open predicates
+  private int countPredicate;
+
   /**
    * The parser constructor.
    */
@@ -160,6 +163,9 @@
           }
           else
                 throw e;
+    } catch (StackOverflowError sof) {
+        error(XPATHErrorResources.ER_PREDICATE_TOO_MANY_OPEN,
+              new Object[]{m_token, m_queueMark, countPredicate});
     }
 
     compiler.shrink();
@@ -193,7 +199,12 @@
     m_ops.setOp(OpMap.MAPINDEX_LENGTH, 2);
 
     nextToken();
-    Pattern();
+    try {
+        Pattern();
+    } catch (StackOverflowError sof) {
+        error(XPATHErrorResources.ER_PREDICATE_TOO_MANY_OPEN,
+              new Object[]{m_token, m_queueMark, countPredicate});
+    }
 
     if (null != m_token)
     {
@@ -789,7 +800,7 @@
    */
   protected void Expr() throws javax.xml.transform.TransformerException
   {
-    OrExpr();
+      OrExpr();
   }
 
   /**
@@ -1931,11 +1942,12 @@
    */
   protected void Predicate() throws javax.xml.transform.TransformerException
   {
-
     if (tokenIs('['))
     {
+      countPredicate++;
       nextToken();
       PredicateExpr();
+      countPredicate--;
       consumeExpected(']');
     }
   }
--- a/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources.java	Thu Sep 12 15:21:44 2019 -0400
+++ b/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources.java	Thu Oct 17 13:47:18 2019 +0100
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 1999-2005 The Apache Software Foundation.
@@ -30,6 +29,7 @@
   * Also you need to  update the count of messages(MAX_CODE)or
  * the count of warnings(MAX_WARNING) [ Information purpose only]
  * @xsl.usage advanced
+ * @LastModified: May 2019
  */
 public class XPATHErrorResources extends ListResourceBundle
 {
@@ -147,6 +147,10 @@
          "ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG";
   public static final String ER_PREDICATE_ILLEGAL_SYNTAX =
          "ER_PREDICATE_ILLEGAL_SYNTAX";
+  public static final String ER_PREDICATE_TOO_MANY_OPEN =
+         "ER_PREDICATE_TOO_MANY_OPEN";
+  public static final String ER_COMPILATION_TOO_MANY_OPERATION =
+         "ER_COMPILATION_TOO_MANY_OPERATION";
   public static final String ER_ILLEGAL_AXIS_NAME = "ER_ILLEGAL_AXIS_NAME";
   public static final String ER_UNKNOWN_NODETYPE = "ER_UNKNOWN_NODETYPE";
   public static final String ER_PATTERN_LITERAL_NEEDS_BE_QUOTED =
@@ -458,6 +462,12 @@
   { ER_PREDICATE_ILLEGAL_SYNTAX,
       "'..[predicate]' or '.[predicate]' is illegal syntax.  Use 'self::node()[predicate]' instead."},
 
+  { ER_PREDICATE_TOO_MANY_OPEN,
+      "Stack overflow while parsing {0} at {1}. Too many open predicates({2})."},
+
+  { ER_COMPILATION_TOO_MANY_OPERATION,
+      "Stack overflow while compiling the expression. Too many operations({0})."},
+
   { ER_ILLEGAL_AXIS_NAME,
      "illegal axis name: {0}"},