changeset 11089:813b9d3bb044

Merge
author kcr
date Fri, 06 Jul 2018 06:16:48 -0700
parents 074705e87b84 0df600e0ab6f
children 2d9a16a6f327
files
diffstat 9 files changed, 179 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/modules/javafx.media/src/main/native/gstreamer/gstreamer-lite/gst-plugins-bad/gst/aiff/aiffparse.c	Fri Jul 06 06:02:47 2018 -0700
+++ b/modules/javafx.media/src/main/native/gstreamer/gstreamer-lite/gst-plugins-bad/gst/aiff/aiffparse.c	Fri Jul 06 06:16:48 2018 -0700
@@ -1343,6 +1343,14 @@
   if (desired >= aiff->bytes_per_sample)
     desired -= (desired % aiff->bytes_per_sample);
 
+#ifdef GSTREAMER_LITE
+  if (desired == 0) {
+    GST_ELEMENT_ERROR (aiff, STREAM, DEMUX, (NULL),
+              ("Invalid stream"));
+    return GST_FLOW_ERROR;
+  }
+#endif // GSTREAMER_LITE
+
   GST_LOG_OBJECT (aiff, "Fetching %" G_GINT64_FORMAT " bytes of data "
       "from the sinkpad", desired);
 
--- a/modules/javafx.media/src/main/native/gstreamer/gstreamer-lite/gst-plugins-good/gst/wavparse/gstwavparse.c	Fri Jul 06 06:02:47 2018 -0700
+++ b/modules/javafx.media/src/main/native/gstreamer/gstreamer-lite/gst-plugins-good/gst/wavparse/gstwavparse.c	Fri Jul 06 06:16:48 2018 -0700
@@ -2064,6 +2064,14 @@
   if (desired >= wav->blockalign && wav->blockalign > 0)
     desired -= (desired % wav->blockalign);
 
+#ifdef GSTREAMER_LITE
+  if (desired == 0) {
+    GST_ELEMENT_ERROR (wav, STREAM, DEMUX, (NULL),
+              ("Invalid stream"));
+    return GST_FLOW_ERROR;
+  }
+#endif // GSTREAMER_LITE
+
   GST_LOG_OBJECT (wav, "Fetching %" G_GINT64_FORMAT " bytes of data "
       "from the sinkpad", desired);
 
--- a/modules/javafx.web/src/main/java/com/sun/javafx/webkit/theme/RenderThemeImpl.java	Fri Jul 06 06:02:47 2018 -0700
+++ b/modules/javafx.web/src/main/java/com/sun/javafx/webkit/theme/RenderThemeImpl.java	Fri Jul 06 06:16:48 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -261,6 +261,9 @@
     {
         ensureNotDefault();
 
+        if (extParams == null) {
+            return null;
+        }
         FormControl fc = pool.get(id);
         WidgetType type = WidgetType.convert(widgetIndex);
 
--- a/modules/javafx.web/src/main/native/Source/WebCore/platform/graphics/java/ImageBufferJava.cpp	Fri Jul 06 06:02:47 2018 -0700
+++ b/modules/javafx.web/src/main/native/Source/WebCore/platform/graphics/java/ImageBufferJava.cpp	Fri Jul 06 06:16:48 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -491,7 +491,7 @@
         static jmethodID midToData = env->GetMethodID(
                 PG_GetImageClass(env),
                 "toData",
-                "(Ljava/lang/String;)Ljava/lang/String;");
+                "(Ljava/lang/String;)[B");
         ASSERT(midToData);
 
         JLocalRef<jbyteArray> jdata((jbyteArray)env->CallObjectMethod(
--- a/modules/javafx.web/src/main/native/Source/WebCore/platform/java/RenderThemeJava.cpp	Fri Jul 06 06:02:47 2018 -0700
+++ b/modules/javafx.web/src/main/native/Source/WebCore/platform/java/RenderThemeJava.cpp	Fri Jul 06 06:16:48 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -187,7 +187,7 @@
     JNIEnv* env = WebCore_GetJavaEnv();
 
     WTF::Vector<jbyte> extParams;
-    if (JNI_EXPAND(SLIDER) == widgetIndex) {
+    if (JNI_EXPAND(SLIDER) == widgetIndex && is<RenderSlider>(object)) {
         HTMLInputElement& input = downcast<RenderSlider>(object).element();
 
         extParams.grow(sizeof(jint) + 3 * sizeof(jfloat));
@@ -210,24 +210,26 @@
         memcpy(data, &valueAsNumber, sizeof(valueAsNumber));
     } else if (JNI_EXPAND(PROGRESS_BAR) == widgetIndex) {
 #if ENABLE(PROGRESS_ELEMENT)
-        RenderProgress& renderProgress = downcast<RenderProgress>(object);
+        if (is<RenderProgress>(object)) {
+            RenderProgress& renderProgress = downcast<RenderProgress>(object);
 
-        extParams.grow(sizeof(jint) + 3*sizeof(jfloat));
-        jbyte *data = extParams.data();
-        auto isDeterminate = jint(renderProgress.isDeterminate() ? 1 : 0);
-        memcpy(data, &isDeterminate, sizeof(isDeterminate));
-        data += sizeof(jint);
+            extParams.grow(sizeof(jint) + 3*sizeof(jfloat));
+            jbyte *data = extParams.data();
+            auto isDeterminate = jint(renderProgress.isDeterminate() ? 1 : 0);
+            memcpy(data, &isDeterminate, sizeof(isDeterminate));
+            data += sizeof(jint);
 
-        auto position = jfloat(renderProgress.position());
-        memcpy(data, &position, sizeof(position));
-        data += sizeof(jfloat);
+            auto position = jfloat(renderProgress.position());
+            memcpy(data, &position, sizeof(position));
+            data += sizeof(jfloat);
 
-        auto animationProgress = jfloat(renderProgress.animationProgress());
-        memcpy(data, &animationProgress, sizeof(animationProgress));
-        data += sizeof(jfloat);
+            auto animationProgress = jfloat(renderProgress.animationProgress());
+            memcpy(data, &animationProgress, sizeof(animationProgress));
+            data += sizeof(jfloat);
 
-        auto animationStartTime = jfloat(renderProgress.animationStartTime());
-        memcpy(data, &animationStartTime, sizeof(animationStartTime));
+            auto animationStartTime = jfloat(renderProgress.animationStartTime());
+            memcpy(data, &animationStartTime, sizeof(animationStartTime));
+        }
 #endif
 #if ENABLE(METER_ELEMENT)
     } else if (JNI_EXPAND(METER) == widgetIndex) {
@@ -238,7 +240,7 @@
             value = meter->valueRatio();
             region = meter->gaugeRegion();
 #if ENABLE(PROGRESS_ELEMENT)
-        } else if (object.isProgress()) {
+        } else if (is<RenderProgress>(object>)) {
             RenderProgress& renderProgress = downcast<RenderProgress>(object);
             value = jfloat(renderProgress.position());
 #endif
--- a/modules/jdk.packager/src/main/java/com/sun/javafx/tools/packager/DeployParams.java	Fri Jul 06 06:02:47 2018 -0700
+++ b/modules/jdk.packager/src/main/java/com/sun/javafx/tools/packager/DeployParams.java	Fri Jul 06 06:16:48 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -495,6 +495,39 @@
                       path);
     }
 
+    public static void validateAppName(String s) throws PackagerException {
+        if (s == null || s.length() == 0) {
+            // empty or null string - there is no unsupported char
+            return;
+        }
+        int last = s.length() - 1;
+
+        char fc = s.charAt(0);
+        char lc = s.charAt(last);
+
+        // illegal to end in backslash escape char
+        if (lc == '\\') {
+            throw new PackagerException("ERR_InvalidCharacterInArgument", "-name");
+        }
+
+        for (int i = 0; i < s.length(); i++) {
+            char a = s.charAt(i);
+            // We check for ASCII codes first which we accept. If check fails,
+            // then check if it is acceptable extended ASCII or unicode character.
+            if (a < ' ' || a > '~' || a == '%') {
+                // Reject '%', whitespaces and ISO Control.
+                // Accept anything else including special characters like copyright
+                // symbols. Note: space will be included by ASCII check above,
+                // but other whitespace like tabs or new line will be ignored.
+                if (Character.isISOControl(a) || Character.isWhitespace(a) || a == '%') {
+                    throw new PackagerException("ERR_InvalidCharacterInArgument", "-name");
+                }
+            }
+            if (a == '"') {
+                throw new PackagerException("ERR_InvalidCharacterInArgument", "-name");
+            }
+        }
+    }
 
     @Override
     public void validate() throws PackagerException {
@@ -514,6 +547,7 @@
                 throw new PackagerException("ERR_MissingArgument", "-appclass");
             }
         }
+        validateAppName(appName);
     }
 
     public boolean validateForJNLP() {
--- a/modules/jdk.packager/src/main/java/com/sun/javafx/tools/packager/MakeAllParams.java	Fri Jul 06 06:02:47 2018 -0700
+++ b/modules/jdk.packager/src/main/java/com/sun/javafx/tools/packager/MakeAllParams.java	Fri Jul 06 06:16:48 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -67,5 +67,6 @@
     }
 
     public void validate() throws PackagerException {
+        DeployParams.validateAppName(appName);
     }
 }
--- a/modules/jdk.packager/src/main/resources/com/sun/javafx/tools/packager/Bundle.properties	Fri Jul 06 06:02:47 2018 -0700
+++ b/modules/jdk.packager/src/main/resources/com/sun/javafx/tools/packager/Bundle.properties	Fri Jul 06 06:16:48 2018 -0700
@@ -207,6 +207,7 @@
 ERR_SignFailed=Error: Signing failed
 ERR_MissingAppResources=Error: No application jars found
 ERR_NoEmbeddedDT=Error: -includedt requires the java deployment toolkit, which is not included in this distribution
+ERR_InvalidCharacterInArgument=Error: Invalid character found in {0} argument
 
 MSG_UpdatingJar=Updating jar file\: {0}
 MSG_NoJREPackaged=Package is configured to ship without a JRE.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/jdk.packager/src/test/java/com/sun/javafx/tools/packager/DeployParamsTest.java	Fri Jul 06 06:16:48 2018 -0700
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.tools.packager;
+
+import java.io.File;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.Before;
+import org.junit.After;
+
+public class DeployParamsTest {
+
+    private File testRoot = null;
+
+    @Before
+    public void setUp() {
+        testRoot = new File("build/tmp/tests/deployParamsTest");
+        testRoot.mkdirs();
+    }
+
+    @After
+    public void tearDown() {
+        if (testRoot != null) {
+            testRoot.delete();
+        }
+    }
+
+    @Test
+    public void testValidateAppName1() throws PackagerException {
+        DeployParams params = getParamsAppName();
+
+        params.setAppName("Test");
+        params.validate();
+
+        params.setAppName("Test Name");
+        params.validate();
+
+        params.setAppName("Test - Name !!!");
+        params.validate();
+    }
+
+    @Test
+    public void testValidateAppName2() throws PackagerException {
+        DeployParams params = getParamsAppName();
+
+        params.setAppName("Test\nName");
+        appName2TestHelper(params);
+
+        params.setAppName("Test\rName");
+        appName2TestHelper(params);
+
+        params.setAppName("TestName\\");
+        appName2TestHelper(params);
+
+        params.setAppName("Test \" Name");
+        appName2TestHelper(params);
+    }
+
+    private void appName2TestHelper(DeployParams params) {
+        try {
+            params.validate();
+            fail("An exception should have been thrown");
+        } catch (PackagerException pe) { }
+    }
+
+    // Returns deploy params initialized to pass all validation, except for
+    // app name
+    private DeployParams getParamsAppName() {
+        DeployParams params = new DeployParams();
+        params.setOutdir(testRoot);
+        params.setOutfile("Test");
+        params.addResource(testRoot, new File(testRoot, "test.jar"));
+        params.setApplicationClass("TestClass");
+        return params;
+    }
+
+}