test/script/basic/JDK-8066215.js

Wed, 03 Jun 2015 18:08:57 +0200

author
hannesw
date
Wed, 03 Jun 2015 18:08:57 +0200
changeset 1396
d5a9705a27b1
parent 1355
e3af6a3cd761
permissions
-rw-r--r--

8066237: Fuzzing bug: Parser error on optimistic recompilation
Reviewed-by: lagergren, attila

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

mercurial