test/script/basic/JDK-8066214.js

Wed, 03 Jun 2015 10:42:06 +0200

author
hannesw
date
Wed, 03 Jun 2015 10:42:06 +0200
changeset 1393
dcbf5e2121e3
parent 1356
02421b7112bb
permissions
-rw-r--r--

8066220: Fuzzing bug: MethodHandle bug (Object,Object) != (boolean)Object
Reviewed-by: lagergren, attila, sundar

hannesw@1356 1 /*
hannesw@1356 2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
hannesw@1356 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
hannesw@1356 4 *
hannesw@1356 5 * This code is free software; you can redistribute it and/or modify it
hannesw@1356 6 * under the terms of the GNU General Public License version 2 only, as
hannesw@1356 7 * published by the Free Software Foundation.
hannesw@1356 8 *
hannesw@1356 9 * This code is distributed in the hope that it will be useful, but WITHOUT
hannesw@1356 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
hannesw@1356 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
hannesw@1356 12 * version 2 for more details (a copy is included in the LICENSE file that
hannesw@1356 13 * accompanied this code).
hannesw@1356 14 *
hannesw@1356 15 * You should have received a copy of the GNU General Public License version
hannesw@1356 16 * 2 along with this work; if not, write to the Free Software Foundation,
hannesw@1356 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
hannesw@1356 18 *
hannesw@1356 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
hannesw@1356 20 * or visit www.oracle.com if you need additional information or have any
hannesw@1356 21 * questions.
hannesw@1356 22 */
hannesw@1356 23
hannesw@1356 24 /**
hannesw@1356 25 * JDK-8066214: Fuzzing bug: Object.prototype.toLocaleString(0)
hannesw@1356 26 *
hannesw@1356 27 * @test
hannesw@1356 28 * @run
hannesw@1356 29 */
hannesw@1356 30
hannesw@1356 31 function test(func) {
hannesw@1356 32 print(func.call(0));
hannesw@1356 33 print(func.call("abc"));
hannesw@1356 34 print(func.call(true));
hannesw@1356 35 try {
hannesw@1356 36 print(func.call(undefined));
hannesw@1356 37 } catch (e) {
hannesw@1356 38 print(e);
hannesw@1356 39 }
hannesw@1356 40 try {
hannesw@1356 41 print(func.call(null));
hannesw@1356 42 } catch (e) {
hannesw@1356 43 print(e);
hannesw@1356 44 }
hannesw@1356 45 }
hannesw@1356 46
hannesw@1356 47 test(Object.prototype.toLocaleString);
hannesw@1356 48 test(Object.prototype.toString);
hannesw@1356 49 test(Object.prototype.valueOf);

mercurial