changeset 11096:e30204a55389

Merge
author kcr
date Sat, 18 Aug 2018 09:11:29 -0700
parents 9bbbcd7d185f 4bc2221b491a
children 5ef044b5fa3c 8afd46818ffc
files
diffstat 10 files changed, 229 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/modules/javafx.media/src/main/native/gstreamer/gstreamer-lite/gst-plugins-bad/gst/aiff/aiffparse.c	Sat Aug 18 08:45:05 2018 -0700
+++ b/modules/javafx.media/src/main/native/gstreamer/gstreamer-lite/gst-plugins-bad/gst/aiff/aiffparse.c	Sat Aug 18 09:11:29 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	Sat Aug 18 08:45:05 2018 -0700
+++ b/modules/javafx.media/src/main/native/gstreamer/gstreamer-lite/gst-plugins-good/gst/wavparse/gstwavparse.c	Sat Aug 18 09:11:29 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	Sat Aug 18 08:45:05 2018 -0700
+++ b/modules/javafx.web/src/main/java/com/sun/javafx/webkit/theme/RenderThemeImpl.java	Sat Aug 18 09:11:29 2018 -0700
@@ -313,26 +313,29 @@
         if (ctrl.isManaged()) {
             ctrl.setManaged(false);
         }
-        if (type == WidgetType.SLIDER) {
-            Slider slider = (Slider)ctrl;
-            extParams.order(ByteOrder.nativeOrder());
-            slider.setOrientation(extParams.getInt()==0
-                ? Orientation.HORIZONTAL
-                : Orientation.VERTICAL);
-            slider.setMax(extParams.getFloat());
-            slider.setMin(extParams.getFloat());
-            slider.setValue(extParams.getFloat());
-        } else if (type == WidgetType.PROGRESSBAR) {
-            ProgressBar progress = (ProgressBar)ctrl;
-            extParams.order(ByteOrder.nativeOrder());
-            progress.setProgress(extParams.getInt() == 1
-                    ? extParams.getFloat()
-                    : progress.INDETERMINATE_PROGRESS);
-        } else if (type == WidgetType.METER) {
-            ProgressBar progress = (ProgressBar) ctrl;
-            extParams.order(ByteOrder.nativeOrder());
-            progress.setProgress(extParams.getFloat());
-            progress.setStyle(getMeterStyle(extParams.getInt()));
+
+        if (extParams != null) {
+            if (type == WidgetType.SLIDER) {
+                Slider slider = (Slider)ctrl;
+                extParams.order(ByteOrder.nativeOrder());
+                slider.setOrientation(extParams.getInt()==0
+                    ? Orientation.HORIZONTAL
+                    : Orientation.VERTICAL);
+                slider.setMax(extParams.getFloat());
+                slider.setMin(extParams.getFloat());
+                slider.setValue(extParams.getFloat());
+            } else if (type == WidgetType.PROGRESSBAR) {
+                ProgressBar progress = (ProgressBar)ctrl;
+                extParams.order(ByteOrder.nativeOrder());
+                progress.setProgress(extParams.getInt() == 1
+                        ? extParams.getFloat()
+                        : progress.INDETERMINATE_PROGRESS);
+            } else if (type == WidgetType.METER) {
+                ProgressBar progress = (ProgressBar) ctrl;
+                extParams.order(ByteOrder.nativeOrder());
+                progress.setProgress(extParams.getFloat());
+                progress.setStyle(getMeterStyle(extParams.getInt()));
+            }
         }
         return new FormControlRef(fc);
     }
--- a/modules/javafx.web/src/main/native/Source/WebCore/platform/graphics/java/ImageBufferJava.cpp	Sat Aug 18 08:45:05 2018 -0700
+++ b/modules/javafx.web/src/main/native/Source/WebCore/platform/graphics/java/ImageBufferJava.cpp	Sat Aug 18 09:11:29 2018 -0700
@@ -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	Sat Aug 18 08:45:05 2018 -0700
+++ b/modules/javafx.web/src/main/native/Source/WebCore/platform/java/RenderThemeJava.cpp	Sat Aug 18 09:11:29 2018 -0700
@@ -177,7 +177,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));
@@ -200,24 +200,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) {
@@ -228,7 +230,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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/javafx.web/src/shims/java/com/sun/javafx/webkit/prism/PrismInvokerShim.java	Sat Aug 18 09:11:29 2018 -0700
@@ -0,0 +1,33 @@
+/*
+ * 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.webkit.prism;
+
+public final class PrismInvokerShim {
+    public static void runOnRenderThread(final Runnable r) {
+        PrismInvoker.runOnRenderThread(r);
+    }
+}
+
--- a/modules/jdk.packager/src/main/java/com/sun/javafx/tools/packager/DeployParams.java	Sat Aug 18 08:45:05 2018 -0700
+++ b/modules/jdk.packager/src/main/java/com/sun/javafx/tools/packager/DeployParams.java	Sat Aug 18 09:11:29 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	Sat Aug 18 08:45:05 2018 -0700
+++ b/modules/jdk.packager/src/main/java/com/sun/javafx/tools/packager/MakeAllParams.java	Sat Aug 18 09:11:29 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	Sat Aug 18 08:45:05 2018 -0700
+++ b/modules/jdk.packager/src/main/resources/com/sun/javafx/tools/packager/Bundle.properties	Sat Aug 18 09:11:29 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	Sat Aug 18 09:11:29 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;
+    }
+
+}