Debian Codegraph @

rhino/testsrc/tests/js1_5/Regress/regress-172699.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 /*
7 *
8 * Date: 07 Oct 2002
9 * SUMMARY: UTF-8 decoder should not accept overlong sequences
10 * See http://bugzilla.mozilla.org/show_bug.cgi?id=172699
11 *
12 */
13 //-----------------------------------------------------------------------------
14 var gTestfile = 'regress-172699.js';
15 var UBound = 0;
16 var BUGNUMBER = 172699;
17 var summary = 'UTF-8 decoder should not accept overlong sequences';
18 var status = '';
19 var statusitems = [];
20 var actual = '';
21 var actualvalues = [];
22 var expect= '';
23 var expectedvalues = [];
24
25 /*
26 * The patch for http://bugzilla.mozilla.org/show_bug.cgi?id=172699
27 * defined this value to be the result of an overlong UTF-8 sequence -
28 */
29 var INVALID_CHAR = 0xFFFD;
30
31
32 status = inSection(1);
33 actual = decodeURI("%C0%AF").charCodeAt(0);
34 expect = INVALID_CHAR;
35 addThis();
36
37
38
39 //-----------------------------------------------------------------------------
40 test();
41 //-----------------------------------------------------------------------------
42
43
44
45 function addThis()
46 {
47 statusitems[UBound] = status;
48 actualvalues[UBound] = actual;
49 expectedvalues[UBound] = expect;
50 UBound++;
51 }
52
53
54 function test()
55 {
56 enterFunc('test');
57 printBugNumber(BUGNUMBER);
58 printStatus(summary);
59
60 for (var i=0; i<UBound; i++)
61 {
62 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
63 }
64
65 exitFunc ('test');
66 }