Mercurial > hg > icedtea8-forest > jdk
changeset 14252:ce6c8c2cad27 icedtea-3.14.0 icedtea-3.15.0pre00
Merge jdk8u232-ga
line wrap: on
line diff
--- a/.hgtags Mon Sep 09 17:27:04 2019 +0100 +++ b/.hgtags Wed Oct 23 15:35:04 2019 +0100 @@ -1074,3 +1074,12 @@ 54dbc9006d379a3987bd55419a5ed0738012bc6b jdk8u232-b01 51afcf17e031f6d29e544d2d2d90d4b66fa69af0 icedtea-3.14.0pre00 740c6726f6fe8a0ebad3392b30a5951af771075d icedtea-3.14.0pre01 +6698d87704f40d6c639858484114ed1f751b32cd jdk8u232-b02 +60eca04567a6d214aa60dd16306f4854bd41b273 jdk8u232-b03 +3ef3348195ffeb3c268af4a43928f2f09c5fa83a jdk8u232-b04 +6d60b8cf1bd4a5fa371b1ddad9d186ff546b25f5 jdk8u232-b05 +5d57817931e1f5b6a460158342f132ea348e14ef jdk8u232-b06 +3560e0ebe876ce658c5261070fe728e47994210f jdk8u232-b07 +69c4f673b33e255599d2aa257fa50fd8b48b7b95 jdk8u232-b08 +5456f24496f43f72b0cf4f0db3a73ea49c33f94f jdk8u232-b09 +5456f24496f43f72b0cf4f0db3a73ea49c33f94f jdk8u232-ga
--- a/THIRD_PARTY_README Mon Sep 09 17:27:04 2019 +0100 +++ b/THIRD_PARTY_README Wed Oct 23 15:35:04 2019 +0100 @@ -1470,60 +1470,90 @@ ------------------------------------------------------------------------------- -%% This notice is provided with respect to libpng 1.6.35, which may be +%% This notice is provided with respect to libpng 1.6.37, which may be included with JRE 8, JDK 8, and OpenJDK 8. --- begin of LICENSE --- -This copy of the libpng notices is provided for your convenience. In case of -any discrepancy between this copy and the notices in the file png.h that is -included in the libpng distribution, the latter shall prevail. - -COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: - -If you modify libpng you may insert additional notices immediately following -this sentence. - -This code is released under the libpng license. - -libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are +COPYRIGHT NOTICE, DISCLAIMER, and LICENSE +========================================= + +PNG Reference Library License version 2 +--------------------------------------- + + * Copyright (c) 1995-2019 The PNG Reference Library Authors. + * Copyright (c) 2018-2019 Cosmin Truta. + * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson. + * Copyright (c) 1996-1997 Andreas Dilger. + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. + +The software is supplied "as is", without warranty of any kind, +express or implied, including, without limitation, the warranties +of merchantability, fitness for a particular purpose, title, and +non-infringement. In no event shall the Copyright owners, or +anyone distributing the software, be liable for any damages or +other liability, whether in contract, tort or otherwise, arising +from, out of, or in connection with the software, or the use or +other dealings in the software, even if advised of the possibility +of such damage. + +Permission is hereby granted to use, copy, modify, and distribute +this software, or portions hereof, for any purpose, without fee, +subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you + must not claim that you wrote the original software. If you + use this software in a product, an acknowledgment in the product + documentation would be appreciated, but is not required. + + 2. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + + 3. This Copyright notice may not be removed or altered from any + source or altered source distribution. + + +PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35) +----------------------------------------------------------------------- + +libpng versions 1.0.7, July 1, 2000, through 1.6.35, July 15, 2018 are Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are derived from libpng-1.0.6, and are distributed according to the same disclaimer and license as libpng-1.0.6 with the following individuals added to the list of Contributing Authors: - Simon-Pierre Cadieux - Eric S. Raymond - Mans Rullgard - Cosmin Truta - Gilles Vollant - James Yu - Mandar Sahastrabuddhe - Google Inc. - Vadim Barkov + Simon-Pierre Cadieux + Eric S. Raymond + Mans Rullgard + Cosmin Truta + Gilles Vollant + James Yu + Mandar Sahastrabuddhe + Google Inc. + Vadim Barkov and with the following additions to the disclaimer: - There is no warranty against interference with your enjoyment of the - library or against infringement. There is no warranty that our - efforts or the library will fulfill any of your particular purposes - or needs. This library is provided with all faults, and the entire - risk of satisfactory quality, performance, accuracy, and effort is with - the user. + There is no warranty against interference with your enjoyment of + the library or against infringement. There is no warranty that our + efforts or the library will fulfill any of your particular purposes + or needs. This library is provided with all faults, and the entire + risk of satisfactory quality, performance, accuracy, and effort is + with the user. Some files in the "contrib" directory and some configure-generated -files that are distributed with libpng have other copyright owners and +files that are distributed with libpng have other copyright owners, and are released under other open source licenses. libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from libpng-0.96, and are distributed according to the same disclaimer and -license as libpng-0.96, with the following individuals added to the list -of Contributing Authors: - - Tom Lane - Glenn Randers-Pehrson - Willem van Schaik +license as libpng-0.96, with the following individuals added to the +list of Contributing Authors: + + Tom Lane + Glenn Randers-Pehrson + Willem van Schaik libpng versions 0.89, June 1996, through 0.96, May 1997, are Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88, @@ -1531,14 +1561,14 @@ libpng-0.88, with the following individuals added to the list of Contributing Authors: - John Bowler - Kevin Bracey - Sam Bushell - Magnus Holmgren - Greg Roelofs - Tom Tanner - -Some files in the "scripts" directory have other copyright owners + John Bowler + Kevin Bracey + Sam Bushell + Magnus Holmgren + Greg Roelofs + Tom Tanner + +Some files in the "scripts" directory have other copyright owners, but are released under this license. libpng versions 0.5, May 1995, through 0.88, January 1996, are @@ -1547,39 +1577,38 @@ For the purposes of this copyright and license, "Contributing Authors" is defined as the following set of individuals: - Andreas Dilger - Dave Martindale - Guy Eric Schalnat - Paul Schmidt - Tim Wegner - -The PNG Reference Library is supplied "AS IS". The Contributing Authors -and Group 42, Inc. disclaim all warranties, expressed or implied, -including, without limitation, the warranties of merchantability and of -fitness for any purpose. The Contributing Authors and Group 42, Inc. -assume no liability for direct, indirect, incidental, special, exemplary, -or consequential damages, which may result from the use of the PNG -Reference Library, even if advised of the possibility of such damage. + Andreas Dilger + Dave Martindale + Guy Eric Schalnat + Paul Schmidt + Tim Wegner + +The PNG Reference Library is supplied "AS IS". The Contributing +Authors and Group 42, Inc. disclaim all warranties, expressed or +implied, including, without limitation, the warranties of +merchantability and of fitness for any purpose. The Contributing +Authors and Group 42, Inc. assume no liability for direct, indirect, +incidental, special, exemplary, or consequential damages, which may +result from the use of the PNG Reference Library, even if advised of +the possibility of such damage. Permission is hereby granted to use, copy, modify, and distribute this source code, or portions hereof, for any purpose, without fee, subject to the following restrictions: - 1. The origin of this source code must not be misrepresented. - - 2. Altered versions must be plainly marked as such and must not - be misrepresented as being the original source. - - 3. This Copyright notice may not be removed or altered from any - source or altered source distribution. - -The Contributing Authors and Group 42, Inc. specifically permit, without -fee, and encourage the use of this source code as a component to -supporting the PNG file format in commercial products. If you use this -source code in a product, acknowledgment is not required but would be -appreciated. - -END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE. + 1. The origin of this source code must not be misrepresented. + + 2. Altered versions must be plainly marked as such and must not + be misrepresented as being the original source. + + 3. This Copyright notice may not be removed or altered from any + source or altered source distribution. + +The Contributing Authors and Group 42, Inc. specifically permit, +without fee, and encourage the use of this source code as a component +to supporting the PNG file format in commercial products. If you use +this source code in a product, acknowledgment is not required but would +be appreciated. TRADEMARK: @@ -2101,13 +2130,13 @@ ------------------------------------------------------------------------------- -%% This notice is provided with respect to PC/SC Lite for Suse Linux v.1.1.1, +%% This notice is provided with respect to PC/SC Lite v1.8.24, which may be included with JRE 8, JDK 8, and OpenJDK 8 on Linux and Solaris. --- begin of LICENSE --- -Copyright (c) 1999-2004 David Corcoran <corcoran@linuxnet.com> -Copyright (c) 1999-2004 Ludovic Rousseau <ludovic.rousseau (at) free.fr> +Copyright (c) 1999-2003 David Corcoran <corcoran@linuxnet.com> +Copyright (c) 2001-2011 Ludovic Rousseau <ludovic.rousseau@free.fr> All rights reserved. Redistribution and use in source and binary forms, with or without @@ -2119,15 +2148,10 @@ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -3. All advertising materials mentioning features or use of this software - must display the following acknowledgement: - This product includes software developed by: - David Corcoran <corcoran@linuxnet.com> - http://www.linuxnet.com (MUSCLE) -4. The name of the author may not be used to endorse or promote products +3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. -Changes to this license can be made only by the copyright author with +Changes to this license can be made only by the copyright author with explicit written consent. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- a/make/data/lsrdata/language-subtag-registry.txt Mon Sep 09 17:27:04 2019 +0100 +++ b/make/data/lsrdata/language-subtag-registry.txt Wed Oct 23 15:35:04 2019 +0100 @@ -1,4 +1,4 @@ -File-Date: 2018-11-30 +File-Date: 2019-04-03 %% Type: language Subtag: aa @@ -43008,6 +43008,7 @@ Description: Lyons Sign Language Added: 2009-07-29 Deprecated: 2018-03-08 +Preferred-Value: lsg Prefix: sgn %% Type: extlang @@ -43406,6 +43407,7 @@ Description: Rennellese Sign Language Added: 2009-07-29 Deprecated: 2017-02-23 +Preferred-Value: rsi Prefix: sgn %% Type: extlang @@ -43760,6 +43762,7 @@ Description: Yiddish Sign Language Added: 2009-07-29 Deprecated: 2015-02-12 +Preferred-Value: yds Prefix: sgn %% Type: extlang @@ -46537,16 +46540,16 @@ Description: Eastern Armenian Added: 2006-09-18 Deprecated: 2018-03-24 -Preferred-Value: hy Prefix: hy +Comments: Preferred tag is hy %% Type: variant Subtag: arevmda Description: Western Armenian Added: 2006-09-18 Deprecated: 2018-03-24 -Preferred-Value: hyw Prefix: hy +Comments: Preferred tag is hyw %% Type: variant Subtag: asante @@ -46642,6 +46645,12 @@ Comments: Jargon embedded in American English %% Type: variant +Subtag: bornholm +Description: Bornholmsk +Added: 2019-03-27 +Prefix: da +%% +Type: variant Subtag: cisaup Description: Cisalpine Added: 2018-04-22
--- a/make/data/tzdata/VERSION Mon Sep 09 17:27:04 2019 +0100 +++ b/make/data/tzdata/VERSION Wed Oct 23 15:35:04 2019 +0100 @@ -21,4 +21,4 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -tzdata2019a +tzdata2019c
--- a/make/data/tzdata/africa Mon Sep 09 17:27:04 2019 +0100 +++ b/make/data/tzdata/africa Wed Oct 23 15:35:04 2019 +0100 @@ -112,7 +112,7 @@ Rule Algeria 1980 only - Oct 31 2:00 0 - # Shanks & Pottenger give 0:09:20 for Paris Mean Time; go with Howse's # more precise 0:09:21. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Africa/Algiers 0:12:12 - LMT 1891 Mar 15 0:01 0:09:21 - PMT 1911 Mar 11 # Paris Mean Time 0:00 Algeria WE%sT 1940 Feb 25 2:00 @@ -147,7 +147,7 @@ # For now, ignore that and follow the 1911-05-26 Portuguese decree # (see Europe/Lisbon). # -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Atlantic/Cape_Verde -1:34:04 - LMT 1912 Jan 01 2:00u # Praia -2:00 - -02 1942 Sep -2:00 1:00 -01 1945 Oct 15 @@ -158,7 +158,7 @@ # See Africa/Lagos. # Chad -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Africa/Ndjamena 1:00:12 - LMT 1912 # N'Djamena 1:00 - WAT 1979 Oct 14 1:00 1:00 WAST 1980 Mar 8 @@ -174,7 +174,7 @@ # See Africa/Lagos. # Côte d'Ivoire / Ivory Coast -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Africa/Abidjan -0:16:08 - LMT 1912 0:00 - GMT Link Africa/Abidjan Africa/Bamako # Mali @@ -379,7 +379,7 @@ Rule Egypt 2014 only - Jul 31 24:00 1:00 S Rule Egypt 2014 only - Sep lastThu 24:00 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Africa/Cairo 2:05:09 - LMT 1900 Oct 2:00 Egypt EE%sT @@ -437,7 +437,7 @@ # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Ghana 1920 1942 - Sep 1 0:00 0:20 - Rule Ghana 1920 1942 - Dec 31 0:00 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Africa/Accra -0:00:52 - LMT 1918 0:00 Ghana GMT/+0020 @@ -451,13 +451,13 @@ # evidently confusing the date of the Portuguese decree # (see Europe/Lisbon) with the date that it took effect. # -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Africa/Bissau -1:02:20 - LMT 1912 Jan 1 1:00u -1:00 - -01 1975 0:00 - GMT # Kenya -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Africa/Nairobi 2:27:16 - LMT 1928 Jul 3:00 - EAT 1930 2:30 - +0230 1940 @@ -492,7 +492,7 @@ # Use the abbreviation "MMT" before 1972, as the more-accurate numeric # abbreviation "-004430" would be one byte over the POSIX limit. # -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Africa/Monrovia -0:43:08 - LMT 1882 -0:43:08 - MMT 1919 Mar # Monrovia Mean Time -0:44:30 - MMT 1972 Jan 7 # approximately MMT @@ -542,7 +542,7 @@ Rule Libya 1997 only - Oct 4 0:00 0 - Rule Libya 2013 only - Mar lastFri 1:00 1:00 S Rule Libya 2013 only - Oct lastFri 2:00 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Africa/Tripoli 0:52:44 - LMT 1920 1:00 Libya CE%sT 1959 2:00 - EET 1982 @@ -652,7 +652,7 @@ Rule Mauritius 1983 only - Mar 21 0:00 0 - Rule Mauritius 2008 only - Oct lastSun 2:00 1:00 - Rule Mauritius 2009 only - Mar lastSun 2:00 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis 4:00 Mauritius +04/+05 # Agalega Is, Rodriguez @@ -883,18 +883,24 @@ # the week end after.... The government does not announce yet the decision # about this temporary change. But it s 99% sure that it will be the case, # as in previous years. An unofficial survey was done these days, showing -# that 64% of asked peopke are ok for moving from +1 to +0 during Ramadan. +# that 64% of asked people are ok for moving from +1 to +0 during Ramadan. # https://leconomiste.com/article/1035870-enquete-l-economiste-sunergia-64-des-marocains-plebiscitent-le-gmt-pendant-ramadan + +# From Naoufal Semlali (2019-04-16): +# Morocco will be on GMT starting from Sunday, May 5th 2019 at 3am. +# The switch to GMT+1 will occur on Sunday, June 9th 2019 at 2am.... +# http://fr.le360.ma/societe/voici-la-date-du-retour-a-lheure-legale-au-maroc-188222 # -# From Paul Eggert (2018-11-01): -# For now, guess that Morocco will fall back at 03:00 the last Sunday -# before Ramadan, and spring forward at 02:00 the first Sunday after +# From Paul Eggert (2019-05-20): +# This agrees with our 2018-11-01 guess that the Moroccan government +# would continue the practice of falling back at 03:00 the last Sunday +# before Ramadan, and of springing forward at 02:00 the first Sunday after # Ramadan, as this has been the practice since 2012. To implement this, -# transition dates for 2019 through 2037 were determined by running the -# following program under GNU Emacs 26.1. +# transition dates for 2019 through 2087 were determined by running the +# following program under GNU Emacs 26.2. # (let ((islamic-year 1440)) # (require 'cal-islam) -# (while (< islamic-year 1460) +# (while (< islamic-year 1511) # (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year))) # (b (calendar-islamic-to-absolute (list 10 1 islamic-year))) # (sunday 0)) @@ -993,8 +999,114 @@ Rule Morocco 2036 only - Nov 23 2:00 1:00 - Rule Morocco 2037 only - Oct 4 3:00 0 - Rule Morocco 2037 only - Nov 15 2:00 1:00 - +Rule Morocco 2038 only - Sep 26 3:00 0 - +Rule Morocco 2038 only - Oct 31 2:00 1:00 - +Rule Morocco 2039 only - Sep 18 3:00 0 - +Rule Morocco 2039 only - Oct 23 2:00 1:00 - +Rule Morocco 2040 only - Sep 2 3:00 0 - +Rule Morocco 2040 only - Oct 14 2:00 1:00 - +Rule Morocco 2041 only - Aug 25 3:00 0 - +Rule Morocco 2041 only - Sep 29 2:00 1:00 - +Rule Morocco 2042 only - Aug 10 3:00 0 - +Rule Morocco 2042 only - Sep 21 2:00 1:00 - +Rule Morocco 2043 only - Aug 2 3:00 0 - +Rule Morocco 2043 only - Sep 6 2:00 1:00 - +Rule Morocco 2044 only - Jul 24 3:00 0 - +Rule Morocco 2044 only - Aug 28 2:00 1:00 - +Rule Morocco 2045 only - Jul 9 3:00 0 - +Rule Morocco 2045 only - Aug 20 2:00 1:00 - +Rule Morocco 2046 only - Jul 1 3:00 0 - +Rule Morocco 2046 only - Aug 5 2:00 1:00 - +Rule Morocco 2047 only - Jun 23 3:00 0 - +Rule Morocco 2047 only - Jul 28 2:00 1:00 - +Rule Morocco 2048 only - Jun 7 3:00 0 - +Rule Morocco 2048 only - Jul 19 2:00 1:00 - +Rule Morocco 2049 only - May 30 3:00 0 - +Rule Morocco 2049 only - Jul 4 2:00 1:00 - +Rule Morocco 2050 only - May 15 3:00 0 - +Rule Morocco 2050 only - Jun 26 2:00 1:00 - +Rule Morocco 2051 only - May 7 3:00 0 - +Rule Morocco 2051 only - Jun 11 2:00 1:00 - +Rule Morocco 2052 only - Apr 28 3:00 0 - +Rule Morocco 2052 only - Jun 2 2:00 1:00 - +Rule Morocco 2053 only - Apr 13 3:00 0 - +Rule Morocco 2053 only - May 25 2:00 1:00 - +Rule Morocco 2054 only - Apr 5 3:00 0 - +Rule Morocco 2054 only - May 10 2:00 1:00 - +Rule Morocco 2055 only - Mar 28 3:00 0 - +Rule Morocco 2055 only - May 2 2:00 1:00 - +Rule Morocco 2056 only - Mar 12 3:00 0 - +Rule Morocco 2056 only - Apr 23 2:00 1:00 - +Rule Morocco 2057 only - Mar 4 3:00 0 - +Rule Morocco 2057 only - Apr 8 2:00 1:00 - +Rule Morocco 2058 only - Feb 17 3:00 0 - +Rule Morocco 2058 only - Mar 31 2:00 1:00 - +Rule Morocco 2059 only - Feb 9 3:00 0 - +Rule Morocco 2059 only - Mar 16 2:00 1:00 - +Rule Morocco 2060 only - Feb 1 3:00 0 - +Rule Morocco 2060 only - Mar 7 2:00 1:00 - +Rule Morocco 2061 only - Jan 16 3:00 0 - +Rule Morocco 2061 only - Feb 27 2:00 1:00 - +Rule Morocco 2062 only - Jan 8 3:00 0 - +Rule Morocco 2062 only - Feb 12 2:00 1:00 - +Rule Morocco 2062 only - Dec 31 3:00 0 - +Rule Morocco 2063 only - Feb 4 2:00 1:00 - +Rule Morocco 2063 only - Dec 16 3:00 0 - +Rule Morocco 2064 only - Jan 20 2:00 1:00 - +Rule Morocco 2064 only - Dec 7 3:00 0 - +Rule Morocco 2065 only - Jan 11 2:00 1:00 - +Rule Morocco 2065 only - Nov 22 3:00 0 - +Rule Morocco 2066 only - Jan 3 2:00 1:00 - +Rule Morocco 2066 only - Nov 14 3:00 0 - +Rule Morocco 2066 only - Dec 19 2:00 1:00 - +Rule Morocco 2067 only - Nov 6 3:00 0 - +Rule Morocco 2067 only - Dec 11 2:00 1:00 - +Rule Morocco 2068 only - Oct 21 3:00 0 - +Rule Morocco 2068 only - Dec 2 2:00 1:00 - +Rule Morocco 2069 only - Oct 13 3:00 0 - +Rule Morocco 2069 only - Nov 17 2:00 1:00 - +Rule Morocco 2070 only - Oct 5 3:00 0 - +Rule Morocco 2070 only - Nov 9 2:00 1:00 - +Rule Morocco 2071 only - Sep 20 3:00 0 - +Rule Morocco 2071 only - Oct 25 2:00 1:00 - +Rule Morocco 2072 only - Sep 11 3:00 0 - +Rule Morocco 2072 only - Oct 16 2:00 1:00 - +Rule Morocco 2073 only - Aug 27 3:00 0 - +Rule Morocco 2073 only - Oct 8 2:00 1:00 - +Rule Morocco 2074 only - Aug 19 3:00 0 - +Rule Morocco 2074 only - Sep 23 2:00 1:00 - +Rule Morocco 2075 only - Aug 11 3:00 0 - +Rule Morocco 2075 only - Sep 15 2:00 1:00 - +Rule Morocco 2076 only - Jul 26 3:00 0 - +Rule Morocco 2076 only - Sep 6 2:00 1:00 - +Rule Morocco 2077 only - Jul 18 3:00 0 - +Rule Morocco 2077 only - Aug 22 2:00 1:00 - +Rule Morocco 2078 only - Jul 10 3:00 0 - +Rule Morocco 2078 only - Aug 14 2:00 1:00 - +Rule Morocco 2079 only - Jun 25 3:00 0 - +Rule Morocco 2079 only - Jul 30 2:00 1:00 - +Rule Morocco 2080 only - Jun 16 3:00 0 - +Rule Morocco 2080 only - Jul 21 2:00 1:00 - +Rule Morocco 2081 only - Jun 1 3:00 0 - +Rule Morocco 2081 only - Jul 13 2:00 1:00 - +Rule Morocco 2082 only - May 24 3:00 0 - +Rule Morocco 2082 only - Jun 28 2:00 1:00 - +Rule Morocco 2083 only - May 16 3:00 0 - +Rule Morocco 2083 only - Jun 20 2:00 1:00 - +Rule Morocco 2084 only - Apr 30 3:00 0 - +Rule Morocco 2084 only - Jun 11 2:00 1:00 - +Rule Morocco 2085 only - Apr 22 3:00 0 - +Rule Morocco 2085 only - May 27 2:00 1:00 - +Rule Morocco 2086 only - Apr 14 3:00 0 - +Rule Morocco 2086 only - May 19 2:00 1:00 - +Rule Morocco 2087 only - Mar 30 3:00 0 - +Rule Morocco 2087 only - May 4 2:00 1:00 - +# For dates after the somewhat-arbitrary cutoff of 2087, assume that +# Morocco will no longer observe DST. At some point this table will +# need to be extended, though quite possibly Morocco will change the +# rules first. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26 0:00 Morocco +00/+01 1984 Mar 16 1:00 - +01 1986 @@ -1024,7 +1136,7 @@ # https://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf # merely made it official? # -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Africa/Maputo 2:10:20 - LMT 1903 Mar 2:00 - CAT Link Africa/Maputo Africa/Blantyre # Malawi @@ -1096,7 +1208,7 @@ Rule Namibia 1995 2017 - Apr Sun>=1 2:00 0 WAT # End of rearguard section. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Africa/Windhoek 1:08:24 - LMT 1892 Feb 8 1:30 - +0130 1903 Mar 2:00 - SAST 1942 Sep 20 2:00 @@ -1117,7 +1229,7 @@ # See Africa/Lagos. # Nigeria -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Africa/Lagos 0:13:36 - LMT 1919 Sep 1:00 - WAT Link Africa/Lagos Africa/Bangui # Central African Republic @@ -1131,7 +1243,7 @@ Link Africa/Lagos Africa/Porto-Novo # Benin # Réunion -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Indian/Reunion 3:41:52 - LMT 1911 Jun # Saint-Denis 4:00 - +04 # @@ -1191,7 +1303,7 @@ # See Africa/Abidjan. # Seychelles -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Indian/Mahe 3:41:48 - LMT 1906 Jun # Victoria 4:00 - +04 # From Paul Eggert (2001-05-30): @@ -1211,7 +1323,7 @@ # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule SA 1942 1943 - Sep Sun>=15 2:00 1:00 - Rule SA 1943 1944 - Mar Sun>=15 2:00 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Africa/Johannesburg 1:52:00 - LMT 1892 Feb 8 1:30 - SAST 1903 Mar 2:00 SA SAST @@ -1246,14 +1358,14 @@ Rule Sudan 1970 1985 - Oct 15 0:00 0 - Rule Sudan 1971 only - Apr 30 0:00 1:00 S Rule Sudan 1972 1985 - Apr lastSun 0:00 1:00 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Africa/Khartoum 2:10:08 - LMT 1931 2:00 Sudan CA%sT 2000 Jan 15 12:00 3:00 - EAT 2017 Nov 1 2:00 - CAT # South Sudan -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Africa/Juba 2:06:28 - LMT 1931 2:00 Sudan CA%sT 2000 Jan 15 12:00 3:00 - EAT @@ -1359,7 +1471,7 @@ # Shanks & Pottenger give 0:09:20 for Paris Mean Time; go with Howse's # more precise 0:09:21. # Shanks & Pottenger say the 1911 switch was on Mar 9; go with Howse's Mar 11. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Africa/Tunis 0:40:44 - LMT 1881 May 12 0:09:21 - PMT 1911 Mar 11 # Paris Mean Time 1:00 Tunisia CE%sT
--- a/make/data/tzdata/antarctica Mon Sep 09 17:27:04 2019 +0100 +++ b/make/data/tzdata/antarctica Wed Oct 23 15:35:04 2019 +0100 @@ -36,7 +36,7 @@ # for information. # Unless otherwise specified, we have no time zone information. -# FORMAT is '-00' and GMTOFF is 0 for locations while uninhabited. +# FORMAT is '-00' and STDOFF is 0 for locations while uninhabited. # Argentina - year-round bases # Belgrano II, Confin Coast, -770227-0343737, since 1972-02-05 @@ -93,7 +93,7 @@ # Australian Antarctica Division informed us that Casey changed time # zone to UTC+11 in "the morning of 22nd October 2016". -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Antarctica/Casey 0 - -00 1969 8:00 - +08 2009 Oct 18 2:00 11:00 - +11 2010 Mar 5 2:00 @@ -165,7 +165,7 @@ # St Paul Island - near Amsterdam, uninhabited # fishing stations operated variously 1819/1931 # -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Indian/Kerguelen 0 - -00 1950 # Port-aux-Français 5:00 - +05 # @@ -176,7 +176,7 @@ # Another base at Port-Martin, 50km east, began operation in 1947. # It was destroyed by fire on 1952-01-14. # -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Antarctica/DumontDUrville 0 - -00 1947 10:00 - +10 1952 Jan 14 0 - -00 1956 Nov @@ -204,7 +204,7 @@ # Syowa station, which is the first antarctic station of Japan, # was established on 1957-01-29. Since Syowa station is still the main # station of Japan, it's appropriate for the principal location. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Antarctica/Syowa 0 - -00 1957 Jan 29 3:00 - +03 # See: @@ -254,7 +254,7 @@ #Rule Troll 2004 max - Nov 7 1:00u 0:00 +00 # Remove the following line when uncommenting the above '#Rule' lines. Rule Troll 2004 max - Oct lastSun 1:00u 0:00 +00 -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Antarctica/Troll 0 - -00 2005 Feb 12 0:00 Troll %s @@ -328,7 +328,7 @@ # From Paul Eggert (2002-10-22) # <http://webexhibits.org/daylightsaving/g.html> says Rothera is -03 all year. # -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Antarctica/Rothera 0 - -00 1976 Dec 1 -3:00 - -03
--- a/make/data/tzdata/asia Mon Sep 09 17:27:04 2019 +0100 +++ b/make/data/tzdata/asia Wed Oct 23 15:35:04 2019 +0100 @@ -31,7 +31,7 @@ # tz@iana.org for general use in the future). For more, please see # the file CONTRIBUTING in the tz distribution. -# From Paul Eggert (2018-06-19): +# From Paul Eggert (2019-07-11): # # Unless otherwise specified, the source for data through 1990 is: # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), @@ -70,13 +70,13 @@ # 7:00 WIB west Indonesia (Waktu Indonesia Barat) # 8:00 WITA central Indonesia (Waktu Indonesia Tengah) # 8:00 CST China -# 8:00 PST PDT* Philippine Standard Time +# 8:00 HKT HKST Hong Kong (HKWT* for Winter Time in late 1941) +# 8:00 PST PDT* Philippines # 8:30 KST KDT Korea when at +0830 # 9:00 WIT east Indonesia (Waktu Indonesia Timur) # 9:00 JST JDT Japan # 9:00 KST KDT Korea when at +09 -# 9:30 ACST Australian Central Standard Time -# *I invented the abbreviation PDT; see "Philippines" below. +# *I invented the abbreviations HKWT and PDT; see below. # Otherwise, these tables typically use numeric abbreviations like +03 # and +0330 for integer hour and minute UT offsets. Although earlier # editions invented alphabetic time zone abbreviations for every @@ -107,7 +107,7 @@ Rule RussiaAsia 1996 2010 - Oct lastSun 2:00s 0 - # Afghanistan -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Kabul 4:36:48 - LMT 1890 4:00 - +04 1945 4:30 - +0430 @@ -140,7 +140,7 @@ # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Armenia 2011 only - Mar lastSun 2:00s 1:00 - Rule Armenia 2011 only - Oct lastSun 2:00s 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Yerevan 2:58:00 - LMT 1924 May 2 3:00 - +03 1957 Mar 4:00 RussiaAsia +04/+05 1991 Mar 31 2:00s @@ -166,7 +166,7 @@ # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Azer 1997 2015 - Mar lastSun 4:00 1:00 - Rule Azer 1997 2015 - Oct lastSun 5:00 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Baku 3:19:24 - LMT 1924 May 2 3:00 - +03 1957 Mar 4:00 RussiaAsia +04/+05 1991 Mar 31 2:00s @@ -254,7 +254,7 @@ Rule Dhaka 2009 only - Jun 19 23:00 1:00 - Rule Dhaka 2009 only - Dec 31 24:00 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Dhaka 6:01:40 - LMT 1890 5:53:20 - HMT 1941 Oct # Howrah Mean Time? 6:30 - +0630 1942 May 15 @@ -264,7 +264,7 @@ 6:00 Dhaka +06/+07 # Bhutan -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Thimphu 5:58:36 - LMT 1947 Aug 15 # or Thimbu 5:30 - +0530 1987 Oct 6:00 - +06 @@ -275,13 +275,13 @@ # We have no information as to when standard time was introduced; # assume it occurred in 1907, the same year as Mauritius (which # then contained the Chagos Archipelago). -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Indian/Chagos 4:49:40 - LMT 1907 5:00 - +05 1996 6:00 - +06 # Brunei -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Brunei 7:39:40 - LMT 1926 Mar # Bandar Seri Begawan 7:30 - +0730 1933 8:00 - +08 @@ -296,7 +296,7 @@ # of Greenwich." This refers to the period before Burma's transition to +0630, # a transition for which Shanks is the only source. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Yangon 6:24:47 - LMT 1880 # or Rangoon 6:24:47 - RMT 1920 # Rangoon local time 6:30 - +0630 1942 May @@ -584,7 +584,7 @@ # that the sort of users who prefer Asia/Urumqi now typically ignored the # +08 mandate back then. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] # Beijing time, used throughout China; represented by Shanghai. Zone Asia/Shanghai 8:05:43 - LMT 1901 8:00 Shang C%sT 1949 May 28 @@ -675,11 +675,50 @@ # https://i.imgur.com/05KkvtC.png # * 1941-09-30, Hong Kong Daily Press, Winter Time Warning. # https://i.imgur.com/dge4kFJ.png -# Also, the Liberation day of Hong Kong after WWII which British rule -# over the territory resumed was August 30, 1945, which I think should -# be the termination date for the use of JST in the territory.... - -# From Paul Eggert (2018-11-17): + +# From Paul Eggert (2019-07-11): +# "Hong Kong winter time" is considered to be daylight saving. +# "Hong Kong had adopted daylight saving on June 15 as a wartime measure, +# clocks moving forward one hour until October 1, when they would be put back +# by just half an hour for 'Hong Kong Winter time', so that daylight saving +# operated year round." -- Low Z. The longest day: when wartime Hong Kong +# introduced daylight saving. South China Morning Post. 2019-06-28. +# https://www.scmp.com/magazines/post-magazine/short-reads/article/3016281/longest-day-when-wartime-hong-kong-introduced + +# From P Chan (2018-12-31): +# * According to the Hong Kong Daylight-Saving Regulations, 1941, the +# 1941 spring-forward transition was at 03:00. +# http://sunzi.lib.hku.hk/hkgro/view/g1941/304271.pdf +# http://sunzi.lib.hku.hk/hkgro/view/g1941/305516.pdf +# * According to some articles from South China Morning Post, +08 was +# resumed on 1945-11-18 at 02:00. +# https://i.imgur.com/M2IsZ3c.png +# https://i.imgur.com/iOPqrVo.png +# https://i.imgur.com/fffcGDs.png +# * Some newspapers ... said the 1946 spring-forward transition was on +# 04-21 at 00:00. The Kung Sheung Evening News 1946-04-20 (Chinese) +# https://i.imgur.com/ZSzent0.png +# https://mmis.hkpl.gov.hk///c/portal/cover?c=QF757YsWv5%2FH7zGe%2FKF%2BFLYsuqGhRBfe p.4 +# The Kung Sheung Daily News 1946-04-21 (Chinese) +# https://i.imgur.com/7ecmRlcm.png +# https://mmis.hkpl.gov.hk///c/portal/cover?c=QF757YsWv5%2BQBGt1%2BwUj5qG2GqtwR3Wh p.4 +# * According to the Summer Time Ordinance (1946), the fallback +# transitions between 1946 and 1952 were at 03:30 Standard Time (+08) +# http://oelawhk.lib.hku.hk/archive/files/bb74b06a74d5294620a15de560ab33c6.pdf +# * Some other laws and regulations related to DST from 1953 to 1979 +# Summer Time Ordinance 1953 +# https://i.imgur.com/IOlJMav.jpg +# Summer Time (Amendment) Ordinance 1965 +# https://i.imgur.com/8rofeLa.jpg +# Interpretation and General Clauses Ordinance (1966) +# https://i.imgur.com/joy3msj.jpg +# Emergency (Summer Time) Regulation 1973 <https://i.imgur.com/OpRWrKz.jpg> +# Interpretation and General Clauses (Amendment) Ordinance 1977 +# https://i.imgur.com/RaNqnc4.jpg +# Resolution of the Legislative Council passed on 9 May 1979 +# https://www.legco.gov.hk/yr78-79/english/lc_sitg/hansard/h790509.pdf#page=39 + +# From Paul Eggert (2019-05-31): # Here are the dates given at # https://www.hko.gov.hk/gts/time/Summertime.htm # as of 2014-06-19: @@ -690,7 +729,7 @@ # 1944 Whole year # 1945 Whole year # 1946 20 Apr to 1 Dec -# 1947 13 Apr to 30 Dec +# 1947 13 Apr to 30 Nov # 1948 2 May to 31 Oct # 1949 3 Apr to 30 Oct # 1950 2 Apr to 29 Oct @@ -727,36 +766,28 @@ # The page does not give times of day for transitions, # or dates for the 1942 and 1945 transitions. # The Japanese occupation of Hong Kong began 1941-12-25. -# The Japanese surrender of Hong Kong was signed 1945-09-16; see: -# Heaver S. The days after the Pacific war ended: unsettling times -# in Hong Kong. Post Magazine. 2016-06-13. -# https://www.scmp.com/magazines/post-magazine/article/1852990/days-after-pacific-war-ended-unsettling-times-hong-kong -# For lack of anything better, use start of those days as the -# transition times. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule HK 1946 only - Apr 20 3:30 1:00 S -Rule HK 1946 only - Dec 1 3:30 0 - -Rule HK 1947 only - Apr 13 3:30 1:00 S -Rule HK 1947 only - Dec 30 3:30 0 - -Rule HK 1948 only - May 2 3:30 1:00 S -Rule HK 1948 1951 - Oct lastSun 3:30 0 - -Rule HK 1952 1953 - Nov Sun>=1 3:30 0 - +Rule HK 1946 only - Apr 21 0:00 1:00 S +Rule HK 1946 only - Dec 1 3:30s 0 - +Rule HK 1947 only - Apr 13 3:30s 1:00 S +Rule HK 1947 only - Nov 30 3:30s 0 - +Rule HK 1948 only - May 2 3:30s 1:00 S +Rule HK 1948 1952 - Oct Sun>=28 3:30s 0 - Rule HK 1949 1953 - Apr Sun>=1 3:30 1:00 S +Rule HK 1953 1964 - Oct Sun>=31 3:30 0 - Rule HK 1954 1964 - Mar Sun>=18 3:30 1:00 S -Rule HK 1954 only - Oct 31 3:30 0 - -Rule HK 1955 1964 - Nov Sun>=1 3:30 0 - Rule HK 1965 1976 - Apr Sun>=16 3:30 1:00 S Rule HK 1965 1976 - Oct Sun>=16 3:30 0 - Rule HK 1973 only - Dec 30 3:30 1:00 S -Rule HK 1979 only - May Sun>=8 3:30 1:00 S -Rule HK 1979 only - Oct Sun>=16 3:30 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Rule HK 1979 only - May 13 3:30 1:00 S +Rule HK 1979 only - Oct 21 3:30 0 - +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Hong_Kong 7:36:42 - LMT 1904 Oct 30 0:36:42 - 8:00 - HKT 1941 Jun 15 3:30 + 8:00 - HKT 1941 Jun 15 3:00 8:00 1:00 HKST 1941 Oct 1 4:00 - 8:30 - HKT 1941 Dec 25 - 9:00 - JST 1945 Sep 16 + 8:00 0:30 HKWT 1941 Dec 25 + 9:00 - JST 1945 Nov 18 2:00 8:00 HK HK%sT ############################################################################### @@ -880,7 +911,7 @@ Rule Taiwan 1979 only - Jul 1 0:00 1:00 D Rule Taiwan 1979 only - Oct 1 0:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] # Taipei or Taibei or T'ai-pei Zone Asia/Taipei 8:06:00 - LMT 1896 Jan 1 8:00 - CST 1937 Oct 1 @@ -1018,7 +1049,7 @@ Rule Macau 1979 only - May 13 03:30 1:00 D Rule Macau 1979 only - Oct Sun>=16 03:30 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Macau 7:34:10 - LMT 1904 Oct 30 8:00 - CST 1941 Dec 21 23:00 9:00 Macau +09/+10 1945 Sep 30 24:00 @@ -1057,7 +1088,7 @@ Rule Cyprus 1978 only - Oct 2 0:00 0 - Rule Cyprus 1979 1997 - Sep lastSun 0:00 0 - Rule Cyprus 1981 1998 - Mar lastSun 0:00 1:00 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Nicosia 2:13:28 - LMT 1921 Nov 14 2:00 Cyprus EE%sT 1998 Sep 2:00 EUAsia EE%sT @@ -1106,7 +1137,7 @@ # Byalokoz 1919 says Georgia was 2:59:11. # Go with Byalokoz. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Tbilisi 2:59:11 - LMT 1880 2:59:11 - TBMT 1924 May 2 # Tbilisi Mean Time 3:00 - +03 1957 Mar @@ -1143,7 +1174,7 @@ # which will be permanent, with no seasonal adjustment, will happen at # midnight on Saturday, September 16. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Dili 8:22:20 - LMT 1912 Jan 1 8:00 - +08 1942 Feb 21 23:00 9:00 - +09 1976 May 3 @@ -1209,7 +1240,7 @@ # time for 1870-1941. Shanks is our only (and dubious) source for the # 1941-1945 data. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Kolkata 5:53:28 - LMT 1854 Jun 28 # Kolkata 5:53:20 - HMT 1870 # Howrah Mean Time? 5:21:10 - MMT 1906 Jan 1 # Madras local time @@ -1261,7 +1292,7 @@ # WITA - +08 - Waktu Indonesia Tengah (Indonesia central time) # WIT - +09 - Waktu Indonesia Timur (Indonesia eastern time) # -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] # Java, Sumatra Zone Asia/Jakarta 7:07:12 - LMT 1867 Aug 10 # Shanks & Pottenger say the next transition was at 1924 Jan 1 0:13, @@ -1337,9 +1368,9 @@ # I used the following code in GNU Emacs 26.1 to generate the "Rule Iran" # lines from 2008 through 2087. Emacs 26.1 uses Ed Reingold's # cal-persia implementation of Birashk's approximation, which in the -# 2008-2087 range disagrees with the the astronomical Persian calendar -# for Persian years 1404 (Gregorian 2025) and 1437 (Gregorian 2058), -# so the following code special-case those years. See Table 15.1, page 264, of: +# 2008-2087 range disagrees with the astronomical Persian calendar +# for Persian years 1404 (Gregorian 2025) and 1437 (Gregorian 2058), so +# the following code special-cases those years. See Table 15.1, page 264, of: # Edward M. Reingold and Nachum Dershowitz, Calendrical Calculations: # The Ultimate Edition, Cambridge University Press (2018). # https://www.cambridge.org/fr/academic/subjects/computer-science/computing-general-interest/calendrical-calculations-ultimate-edition-4th-edition @@ -1533,7 +1564,7 @@ Rule Iran 2088 max - Mar 20 24:00 1:00 - Rule Iran 2088 max - Sep 20 24:00 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Tehran 3:25:44 - LMT 1916 3:25:44 - TMT 1946 # Tehran Mean Time 3:30 - +0330 1977 Nov @@ -1578,7 +1609,7 @@ # Rule Iraq 1991 2007 - Apr 1 3:00s 1:00 - Rule Iraq 1991 2007 - Oct 1 3:00s 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Baghdad 2:57:40 - LMT 1890 2:57:36 - BMT 1918 # Baghdad Mean Time? 3:00 - +03 1982 May @@ -1645,7 +1676,7 @@ Rule Zion 1975 only - Aug 31 0:00 0 S # From Alois Treindl (2019-03-06): -# http://www.moin.gov.il/Documents/שעון קיץ/clock-50-years-7-2014.pdf +# http://www.moin.gov.il/Documents/שעון%20קיץ/clock-50-years-7-2014.pdf # From Isaac Starkman (2019-03-06): # Summer time was in that period in 1980 and 1984, see # https://www.ynet.co.il/articles/0,7340,L-3951073,00.html @@ -1783,32 +1814,15 @@ # # ftp://ftp.cs.huji.ac.il/pub/tz/announcements/2005+beyond.ps -# From Paul Eggert (2012-10-26): -# I used Ephraim Silverberg's dst-israel.el program -# <ftp://ftp.cs.huji.ac.il/pub/tz/software/dst-israel.el> (2005-02-20) -# along with Ed Reingold's cal-hebrew in GNU Emacs 21.4, -# to generate the transitions from 2005 through 2012. -# (I replaced "lastFri" with "Fri>=26" by hand.) -# The spring transitions all correspond to the following Rule: -# -# Rule Zion 2005 2012 - Mar Fri>=26 2:00 1:00 D -# -# but older zic implementations (e.g., Solaris 8) do not support -# "Fri>=26" to mean April 1 in years like 2005, so for now we list the -# springtime transitions explicitly. - # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Zion 2005 only - Apr 1 2:00 1:00 D +Rule Zion 2005 2012 - Apr Fri<=1 2:00 1:00 D Rule Zion 2005 only - Oct 9 2:00 0 S -Rule Zion 2006 2010 - Mar Fri>=26 2:00 1:00 D Rule Zion 2006 only - Oct 1 2:00 0 S Rule Zion 2007 only - Sep 16 2:00 0 S Rule Zion 2008 only - Oct 5 2:00 0 S Rule Zion 2009 only - Sep 27 2:00 0 S Rule Zion 2010 only - Sep 12 2:00 0 S -Rule Zion 2011 only - Apr 1 2:00 1:00 D Rule Zion 2011 only - Oct 2 2:00 0 S -Rule Zion 2012 only - Mar Fri>=26 2:00 1:00 D Rule Zion 2012 only - Sep 23 2:00 0 S # From Ephraim Silverberg (2013-06-27): @@ -1824,7 +1838,7 @@ Rule Zion 2013 max - Mar Fri>=23 2:00 1:00 D Rule Zion 2013 max - Oct lastSun 2:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Jerusalem 2:20:54 - LMT 1880 2:20:40 - JMT 1918 # Jerusalem Mean Time? 2:00 Zion I%sT @@ -1916,7 +1930,7 @@ # Central Time (UT+9). The adoption began on Oct 1, 1937. # https://ja.wikisource.org/wiki/明治二十八年勅令第百六十七號標準時ニ關スル件中改正ノ件 -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Tokyo 9:18:59 - LMT 1887 Dec 31 15:00u 9:00 Japan J%sT # Since 1938, all Japanese possessions have been like Asia/Tokyo, @@ -2019,7 +2033,7 @@ Rule Jordan 2013 only - Dec 20 0:00 0 - Rule Jordan 2014 max - Mar lastThu 24:00 1:00 S Rule Jordan 2014 max - Oct lastFri 0:00s 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Amman 2:23:44 - LMT 1931 2:00 Jordan EE%sT @@ -2060,8 +2074,8 @@ # text. # # According to Izvestia newspaper No. 68 (23334) from 1991-03-20 -# (page 6; available at http://libinfo.org/newsr/newsr2574.djvu via -# http://libinfo.org/index.php?id=58564) on 1991-03-31 at 2:00 during +# -- page 6; available at http://libinfo.org/newsr/newsr2574.djvu via +# http://libinfo.org/index.php?id=58564 -- on 1991-03-31 at 2:00 during # transition to "summer" time: # Republic of Georgia, Latvian SSR, Lithuanian SSR, SSR Moldova, # Estonian SSR; Komi ASSR; Kaliningrad oblast; Nenets autonomous okrug @@ -2077,7 +2091,7 @@ # Apparently there were last minute changes. Apparently Kazakh act No. 170 # was one of such changes. # -# https://ru.wikipedia.org/wiki/Декретное время +# https://ru.wikipedia.org/wiki/Декретное_время # claims that Sovetskaya Rossiya newspaper on 1991-03-29 published that # Nenets autonomous okrug, Komi and Kazakhstan (excluding Uralsk oblast) # were to not move clocks and Uralsk oblast was to move clocks @@ -2216,7 +2230,7 @@ # UTC+6 to UTC+5 effective December 21st, 2018. The legal document is # located here: http://adilet.zan.kz/rus/docs/P1800000817 (russian language). -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] # # Almaty (formerly Alma-Ata), representing most locations in Kazakhstan # This includes KZ-AKM, KZ-ALA, KZ-ALM, KZ-AST, KZ-BAY, KZ-VOS, KZ-ZHA, @@ -2318,7 +2332,7 @@ Rule Kyrgyz 1992 1996 - Sep lastSun 0:00 0 - Rule Kyrgyz 1997 2005 - Mar lastSun 2:30 1:00 - Rule Kyrgyz 1997 2004 - Oct lastSun 2:30 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Bishkek 4:58:24 - LMT 1924 May 2 5:00 - +05 1930 Jun 21 6:00 RussiaAsia +06/+07 1991 Mar 31 2:00s @@ -2433,11 +2447,11 @@ # The BBC reported that the transition was from 23:30 to 24:00 today. # https://www.bbc.com/news/world-asia-44010705 -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Seoul 8:27:52 - LMT 1908 Apr 1 8:30 - KST 1912 Jan 1 9:00 - JST 1945 Sep 8 - 9:00 - KST 1954 Mar 21 + 9:00 ROK K%sT 1954 Mar 21 8:30 ROK K%sT 1961 Aug 10 9:00 ROK K%sT Zone Asia/Pyongyang 8:23:00 - LMT 1908 Apr 1 @@ -2482,7 +2496,7 @@ Rule Lebanon 1993 max - Mar lastSun 0:00 1:00 S Rule Lebanon 1993 1998 - Sep lastSun 0:00 0 - Rule Lebanon 1999 max - Oct lastSun 0:00 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Beirut 2:22:00 - LMT 1880 2:00 Lebanon EE%sT @@ -2494,7 +2508,7 @@ # peninsular Malaysia # taken from Mok Ly Yng (2003-10-30) # http://www.math.nus.edu.sg/aslaksen/teaching/timezone.html -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Kuala_Lumpur 6:46:46 - LMT 1901 Jan 1 6:55:25 - SMT 1905 Jun 1 # Singapore M.T. 7:00 - +07 1933 Jan 1 @@ -2508,7 +2522,7 @@ # From Paul Eggert (2014-08-12): # The data entries here are mostly from Shanks & Pottenger, but the 1942, 1945 # and 1982 transition dates are from Mok Ly Yng. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Kuching 7:21:20 - LMT 1926 Mar 7:30 - +0730 1933 8:00 NBorneo +08/+0820 1942 Feb 16 @@ -2516,7 +2530,7 @@ 8:00 - +08 # Maldives -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Indian/Maldives 4:54:00 - LMT 1880 # Malé 4:54:00 - MMT 1960 # Malé Mean Time 5:00 - +05 @@ -2659,7 +2673,7 @@ Rule Mongol 2015 2016 - Mar lastSat 2:00 1:00 - Rule Mongol 2015 2016 - Sep lastSat 0:00 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] # Hovd, a.k.a. Chovd, Dund-Us, Dzhargalant, Khovd, Jirgalanta Zone Asia/Hovd 6:06:36 - LMT 1905 Aug 6:00 - +06 1978 @@ -2677,7 +2691,7 @@ 8:00 Mongol +08/+09 # Nepal -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Kathmandu 5:41:16 - LMT 1920 5:30 - +0530 1986 5:45 - +0545 @@ -2827,7 +2841,7 @@ Rule Pakistan 2008 2009 - Nov 1 0:00 0 - Rule Pakistan 2009 only - Apr 15 0:00 1:00 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Karachi 4:28:12 - LMT 1907 5:30 - +0530 1942 Sep 5:30 1:00 +0630 1945 Oct 15 @@ -3114,13 +3128,21 @@ # http://www.palestinecabinet.gov.ps/Website/AR/NDecrees/ViewFile.ashx?ID=e7a42ab7-ee23-435a-b9c8-a4f7e81f3817 # From Even Scharning (2019-03-23): -# DST in Palestine will start on 30 March this year, not 23 March as the time -# zone database predicted. -# https://ramallah.news/post/123610 +# http://pnn.ps/news/401130 +# http://palweather.ps/ar/node/50136.html # -# From Tim Parenti (2019-03-23): -# Combining this with the rules observed since 2016, adjust our spring -# transition guess to Mar Sat>=24. +# From Sharif Mustafa (2019-03-26): +# The Palestinian cabinet announced today that the switch to DST will +# be on Fri Mar 29th 2019 by advancing the clock by 60 minutes. +# The decree signing date is Mar 12th but it was not published till today. +# The decree does not specify the exact time of switch. +# http://palestinecabinet.gov.ps/Website/AR/NDecrees/ViewFile.ashx?ID=e54e9ea1-50ee-4137-84df-0d6c78da259b +# +# From Even Scharning (2019-04-10): +# Our source in Palestine said it happened Friday 29 at 00:00 local time.... +# +# From Paul Eggert (2019-04-10): +# For now, guess spring-ahead transitions are March's last Friday at 00:00. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule EgyptAsia 1957 only - May 10 0:00 1:00 S @@ -3151,10 +3173,11 @@ Rule Palestine 2013 only - Sep Fri>=21 0:00 0 - Rule Palestine 2014 2015 - Oct Fri>=21 0:00 0 - Rule Palestine 2015 only - Mar lastFri 24:00 1:00 S -Rule Palestine 2016 max - Mar Sat>=24 1:00 1:00 S +Rule Palestine 2016 2018 - Mar Sat>=24 1:00 1:00 S Rule Palestine 2016 max - Oct lastSat 1:00 0 - - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Rule Palestine 2019 max - Mar lastFri 0:00 1:00 S + +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Gaza 2:17:52 - LMT 1900 Oct 2:00 Zion EET/EEST 1948 May 15 2:00 EgyptAsia EE%sT 1967 Jun 5 @@ -3228,7 +3251,7 @@ Rule Phil 1954 only - Jul 1 0:00 0 S Rule Phil 1978 only - Mar 22 0:00 1:00 D Rule Phil 1978 only - Sep 21 0:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Manila -15:56:00 - LMT 1844 Dec 31 8:04:00 - LMT 1899 May 11 8:00 Phil P%sT 1942 May @@ -3236,7 +3259,7 @@ 8:00 Phil P%sT # Qatar -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Qatar 3:26:08 - LMT 1920 # Al Dawhah / Doha 4:00 - +04 1972 Jun 3:00 - +03 @@ -3284,7 +3307,7 @@ # the country. Presumably this is documenting airline time. Ignore this, # as it's before our 1970 cutoff. # -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Riyadh 3:06:52 - LMT 1947 Mar 14 3:00 - +03 Link Asia/Riyadh Asia/Aden # Yemen @@ -3293,7 +3316,7 @@ # Singapore # taken from Mok Ly Yng (2003-10-30) # http://www.math.nus.edu.sg/aslaksen/teaching/timezone.html -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Singapore 6:55:25 - LMT 1901 Jan 1 6:55:25 - SMT 1905 Jun 1 # Singapore M.T. 7:00 - +07 1933 Jan 1 @@ -3357,7 +3380,7 @@ # even worse. For now, let's use a numeric abbreviation; we can # switch to "SLST" if it catches on. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Colombo 5:19:24 - LMT 1880 5:19:32 - MMT 1906 # Moratuwa Mean Time 5:30 - +0530 1942 Jan 5 @@ -3527,13 +3550,13 @@ Rule Syria 2012 max - Mar lastFri 0:00 1:00 S Rule Syria 2009 max - Oct lastFri 0:00 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Damascus 2:25:12 - LMT 1920 # Dimashq 2:00 Syria EE%sT # Tajikistan # From Shanks & Pottenger. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Dushanbe 4:35:12 - LMT 1924 May 2 5:00 - +05 1930 Jun 21 6:00 RussiaAsia +06/+07 1991 Mar 31 2:00s @@ -3541,7 +3564,7 @@ 5:00 - +05 # Thailand -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Bangkok 6:42:04 - LMT 1880 6:42:04 - BMT 1920 Apr # Bangkok Mean Time 7:00 - +07 @@ -3550,7 +3573,7 @@ # Turkmenistan # From Shanks & Pottenger. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Ashgabat 3:53:32 - LMT 1924 May 2 # or Ashkhabad 4:00 - +04 1930 Jun 21 5:00 RussiaAsia +05/+06 1991 Mar 31 2:00 @@ -3558,14 +3581,14 @@ 5:00 - +05 # United Arab Emirates -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Dubai 3:41:12 - LMT 1920 4:00 - +04 Link Asia/Dubai Asia/Muscat # Oman # Uzbekistan # Byalokoz 1919 says Uzbekistan was 4:27:53. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Samarkand 4:27:53 - LMT 1924 May 2 4:00 - +04 1930 Jun 21 5:00 - +05 1981 Apr 1 @@ -3613,7 +3636,7 @@ # and in South Vietnam in particular (after 1954): # To 07:00 on 1911-05-01. # To 08:00 on 1942-12-31 at 23:00. -# To 09:00 in 1945-03-14 at 23:00. +# To 09:00 on 1945-03-14 at 23:00. # To 07:00 on 1945-09-02 in Vietnam. # To 08:00 on 1947-04-01 in French-controlled Indochina. # To 07:00 on 1955-07-01 in South Vietnam. @@ -3631,7 +3654,7 @@ # Lê Thành Lân: "Lịch hai thế kỷ (1802-2010) và các lịch vĩnh cửu", # NXB Thuận Hoá, Huế, 1995. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Ho_Chi_Minh 7:06:40 - LMT 1906 Jul 1 7:06:30 - PLMT 1911 May 1 # Phù Liễn MT 7:00 - +07 1942 Dec 31 23:00
--- a/make/data/tzdata/australasia Mon Sep 09 17:27:04 2019 +0100 +++ b/make/data/tzdata/australasia Wed Oct 23 15:35:04 2019 +0100 @@ -48,7 +48,7 @@ # says W Australia didn't use DST in 1943/1944. Ignore Whitman's claim that # 1944/1945 was just like 1943/1944. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] # Northern Territory Zone Australia/Darwin 8:43:20 - LMT 1895 Feb 9:00 - ACST 1899 May @@ -125,7 +125,7 @@ Rule AS 2007 only - Mar lastSun 2:00s 0 S Rule AS 2008 max - Apr Sun>=1 2:00s 0 S Rule AS 2008 max - Oct Sun>=1 2:00s 1:00 D -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Australia/Adelaide 9:14:20 - LMT 1895 Feb 9:00 - ACST 1899 May 9:30 Aus AC%sT 1971 @@ -157,7 +157,7 @@ Rule AT 2006 only - Apr Sun>=1 2:00s 0 S Rule AT 2007 only - Mar lastSun 2:00s 0 S Rule AT 2008 max - Apr Sun>=1 2:00s 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Australia/Hobart 9:49:16 - LMT 1895 Sep 10:00 - AEST 1916 Oct 1 2:00 10:00 1:00 AEDT 1917 Feb @@ -185,7 +185,7 @@ Rule AV 2007 only - Mar lastSun 2:00s 0 S Rule AV 2008 max - Apr Sun>=1 2:00s 0 S Rule AV 2008 max - Oct Sun>=1 2:00s 1:00 D -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Australia/Melbourne 9:39:52 - LMT 1895 Feb 10:00 Aus AE%sT 1971 10:00 AV AE%sT @@ -208,7 +208,7 @@ Rule AN 2007 only - Mar lastSun 2:00s 0 S Rule AN 2008 max - Apr Sun>=1 2:00s 0 S Rule AN 2008 max - Oct Sun>=1 2:00s 1:00 D -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Australia/Sydney 10:04:52 - LMT 1895 Feb 10:00 Aus AE%sT 1971 10:00 AN AE%sT @@ -279,14 +279,14 @@ 11:00 - +11 # Christmas -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Indian/Christmas 7:02:52 - LMT 1895 Feb 7:00 - +07 # Cocos (Keeling) Is # These islands were ruled by the Ross family from about 1830 to 1978. # We don't know when standard time was introduced; for now, we guess 1900. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Indian/Cocos 6:27:40 - LMT 1900 6:30 - +0630 @@ -390,13 +390,18 @@ # From Raymond Kumar (2018-07-13): # http://www.fijitimes.com/government-approves-2018-daylight-saving/ # ... The daylight saving period will end at 3am on Sunday January 13, 2019. -# -# From Paul Eggert (2018-07-15): -# For now, guess DST from 02:00 the first Sunday in November to 03:00 -# the first Sunday on or after January 13. January transitions reportedly + +# From Paul Eggert (2019-08-06): +# Today Raymond Kumar reported the Government of Fiji Gazette Supplement No. 27 +# (2019-08-02) said that Fiji observes DST "commencing at 2.00 am on +# Sunday, 10 November 2019 and ending at 3.00 am on Sunday, 12 January 2020." +# For now, guess DST from 02:00 the second Sunday in November to 03:00 +# the first Sunday on or after January 12. January transitions reportedly # depend on when school terms start. Although the guess is ad hoc, it matches -# transitions since late 2014 and seems more likely to match future -# practice than guessing no DST. +# transitions planned this year and seems more likely to match future practice +# than guessing no DST. +# From Michael Deckers (2019-08-06): +# https://www.laws.gov.fj/LawsAsMade/downloadfile/848 # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 - @@ -407,14 +412,15 @@ Rule Fiji 2011 only - Mar Sun>=1 3:00 0 - Rule Fiji 2012 2013 - Jan Sun>=18 3:00 0 - Rule Fiji 2014 only - Jan Sun>=18 2:00 0 - -Rule Fiji 2014 max - Nov Sun>=1 2:00 1:00 - -Rule Fiji 2015 max - Jan Sun>=13 3:00 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Rule Fiji 2014 2018 - Nov Sun>=1 2:00 1:00 - +Rule Fiji 2015 max - Jan Sun>=12 3:00 0 - +Rule Fiji 2019 max - Nov Sun>=8 2:00 1:00 - +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Fiji 11:55:44 - LMT 1915 Oct 26 # Suva 12:00 Fiji +12/+13 # French Polynesia -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Gambier -8:59:48 - LMT 1912 Oct # Rikitea -9:00 - -09 Zone Pacific/Marquesas -9:18:00 - LMT 1912 Oct @@ -457,7 +463,7 @@ # http://documents.guam.gov/wp-content/uploads/E.O.-77-18-Guam-Standard-Time.pdf Rule Guam 1977 only - Aug 28 2:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Guam -14:21:00 - LMT 1844 Dec 31 9:39:00 - LMT 1901 # Agana 10:00 - GST 1941 Dec 10 # Guam @@ -467,7 +473,7 @@ Link Pacific/Guam Pacific/Saipan # N Mariana Is # Kiribati -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Tarawa 11:32:04 - LMT 1901 # Bairiki 12:00 - +12 Zone Pacific/Enderbury -11:24:20 - LMT 1901 @@ -483,7 +489,7 @@ # See Pacific/Guam. # Marshall Is -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Majuro 11:24:48 - LMT 1901 11:00 - +11 1914 Oct 9:00 - +09 1919 Feb 1 @@ -501,7 +507,7 @@ 12:00 - +12 # Micronesia -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Chuuk -13:52:52 - LMT 1844 Dec 31 10:07:08 - LMT 1901 10:00 - +10 1914 Oct @@ -529,7 +535,7 @@ 11:00 - +11 # Nauru -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Nauru 11:07:40 - LMT 1921 Jan 15 # Uaobe 11:30 - +1130 1942 Aug 29 9:00 - +09 1945 Sep 8 @@ -543,7 +549,7 @@ Rule NC 1996 only - Dec 1 2:00s 1:00 - # Shanks & Pottenger say the following was at 2:00; go with IATA. Rule NC 1997 only - Mar 2 2:00s 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Noumea 11:05:48 - LMT 1912 Jan 13 # Nouméa 11:00 NC +11/+12 @@ -582,7 +588,7 @@ Rule Chatham 2007 max - Sep lastSun 2:45s 1:00 - Rule NZ 2008 max - Apr Sun>=1 2:00s 0 S Rule Chatham 2008 max - Apr Sun>=1 2:45s 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Auckland 11:39:04 - LMT 1868 Nov 2 11:30 NZ NZ%sT 1946 Jan 1 12:00 NZ NZ%sT @@ -608,7 +614,7 @@ Rule Cook 1978 only - Nov 12 0:00 0:30 - Rule Cook 1979 1991 - Mar Sun>=1 0:00 0 - Rule Cook 1979 1990 - Oct lastSun 0:00 0:30 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Rarotonga -10:39:04 - LMT 1901 # Avarua -10:30 - -1030 1978 Nov 12 -10:00 Cook -10/-0930 @@ -617,29 +623,30 @@ # Niue -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Niue -11:19:40 - LMT 1901 # Alofi -11:20 - -1120 1951 -11:30 - -1130 1978 Oct 1 -11:00 - -11 # Norfolk -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Norfolk 11:11:52 - LMT 1901 # Kingston 11:12 - +1112 1951 - 11:30 - +1130 1974 Oct 27 02:00 - 11:30 1:00 +1230 1975 Mar 2 02:00 - 11:30 - +1130 2015 Oct 4 02:00 - 11:00 - +11 + 11:30 - +1130 1974 Oct 27 02:00s + 11:30 1:00 +1230 1975 Mar 2 02:00s + 11:30 - +1130 2015 Oct 4 02:00s + 11:00 - +11 2019 Jul + 11:00 AN +11/+12 # Palau (Belau) -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Palau -15:02:04 - LMT 1844 Dec 31 # Koror 8:57:56 - LMT 1901 9:00 - +09 # Papua New Guinea -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Port_Moresby 9:48:40 - LMT 1880 9:48:32 - PMMT 1895 # Port Moresby Mean Time 10:00 - +10 @@ -669,7 +676,7 @@ 11:00 - +11 # Pitcairn -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Pitcairn -8:40:20 - LMT 1901 # Adamstown -8:30 - -0830 1998 Apr 27 0:00 -8:00 - -08 @@ -754,7 +761,7 @@ Rule WS 2011 only - Sep lastSat 3:00 1 - Rule WS 2012 max - Apr Sun>=1 4:00 0 - Rule WS 2012 max - Sep lastSun 3:00 1 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Apia 12:33:04 - LMT 1892 Jul 5 -11:26:56 - LMT 1911 -11:30 - -1130 1950 @@ -763,7 +770,7 @@ # Solomon Is # excludes Bougainville, for which see Papua New Guinea -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Guadalcanal 10:39:48 - LMT 1912 Oct # Honiara 11:00 - +11 @@ -786,7 +793,7 @@ # was "11 hours slow on G.M.T." Go with Thorsen and assume Shanks & Pottenger # are off by an hour starting in 1901. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Fakaofo -11:24:56 - LMT 1901 -11:00 - -11 2011 Dec 30 13:00 - +13 @@ -799,14 +806,14 @@ Rule Tonga 2001 2002 - Jan lastSun 2:00 0 - Rule Tonga 2016 only - Nov Sun>=1 2:00 1:00 - Rule Tonga 2017 only - Jan Sun>=15 3:00 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Tongatapu 12:19:20 - LMT 1901 12:20 - +1220 1941 13:00 - +13 1999 13:00 Tonga +13/+14 # Tuvalu -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Funafuti 11:56:52 - LMT 1901 12:00 - +12 @@ -867,7 +874,7 @@ # uninhabited since World War II; was probably like Pacific/Kiritimati # Wake -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Wake 11:06:28 - LMT 1901 12:00 - +12 @@ -880,12 +887,12 @@ Rule Vanuatu 1985 1991 - Sep Sun>=23 0:00 1:00 - Rule Vanuatu 1992 1993 - Jan Sun>=23 0:00 0 - Rule Vanuatu 1992 only - Oct Sun>=23 0:00 1:00 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Efate 11:13:16 - LMT 1912 Jan 13 # Vila 11:00 Vanuatu +11/+12 # Wallis and Futuna -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Wallis 12:15:20 - LMT 1901 12:00 - +12 @@ -1271,6 +1278,22 @@ # in WA or its introduction in SA had anything to do with the genesis # of this time zone. My hunch is that it's been around since well # before 1975. I remember seeing it noted on road maps decades ago. +# +# From Gilmore Davidson (2019-04-08): +# https://www.abc.net.au/news/2019-04-08/this-remote-stretch-of-desert-has-its-own-custom-time-zone/10981000 +# ... include[s] a rough description of the geographical boundaries... +# "The time zone exists for about 340 kilometres and takes in the tiny +# roadhouse communities of Cocklebiddy, Madura, Eucla and Border Village." +# ... and an indication that the zone has definitely been in existence +# since before the 1970 cut-off of the database ... +# From Paul Eggert (2019-05-17): +# That ABC Esperance story by Christien de Garis also says: +# Although the Central Western Time Zone is not officially recognised (your +# phones won't automatically change), there is a sign instructing you which +# way to wind your clocks 45 minutes and scrawled underneath one of them in +# Texta is the word: 'Why'? +# "Good question," Mr Pike said. +# "I don't even know that, and it's been going for over 50 years." # From Paul Eggert (2006-12-15): # For lack of better info, assume the tradition dates back to the @@ -1589,6 +1612,42 @@ ############################################################################### +# Bonin (Ogasawara) Islands and Marcus Island (Minami-Tori-shima) + +# From Wakaba (2019-01-28) via Phake Nick: +# National Diet Library of Japan has several reports by Japanese Government +# officers that describe the time used in islands when they visited there. +# According to them (and other sources such as newspapers), standard time UTC +# + 10 (JST + 1) and DST UTC + 11 (JST + 2) was used until its return to Japan +# at 1968-06-26 00:00 JST. The exact periods of DST are still unknown. +# I guessed Guam, Mariana, and Bonin and Marcus districts might have +# synchronized their DST periods, but reports imply they had their own +# decisions, i.e. there were three or more different time zones.... +# +# https://wiki.suikawiki.org/n/小笠原諸島の標準時 + +# From Phake Nick (2019-02-12): +# Because their last time change to return to Japanese time when they returned +# to Japanese rule was right before 1970, ... per the current tz database +# rule, the information doesn't warrant creation of a new timezone for Bonin +# Islands itself and is thus as an anecdotal note for interest purpose only. +# ... [The abovementioned link] described some special timekeeping phenomenon +# regarding Marcus island, another remote island currently owned by Japanese +# in the same administrative unit as Bonin Islands. Many reports claim that +# the American coastal guard on the American quarter of the island use its own +# coastal guard time, and most sources describe the time as UTC+11, being two +# hours faster than JST used by some Japanese personnel on the island. Some +# sites describe it as same as Wake Island/Guam time although it would be +# incorrect to be same as Guam. And then in a few Japanese governmental +# report from 1980s (from National Institute of Information and Communications +# Technology) regarding the construction of VLBI facility on the Marcus +# Island, it claimed that there are three time standards being used on the +# island at the time which include not just JST (UTC+9) or [US]CG time +# (UTC+11) but also a JMSDF time (UTC+10) (Japan Maritime Self-Defense +# Force). Unfortunately there are no other sources that mentioned such time +# and there are also no information on things like how the time was used. + + # Fiji # Howse writes (p 153) that in 1879 the British governor of Fiji @@ -1846,12 +1905,21 @@ # ... at 12.30 am (by legal time in New South Wales) on 4 October 2015. # http://www.norfolkisland.gov.nf/nia/MediaRelease/Media%20Release%20Norfolk%20Island%20Standard%20Time%20Change.pdf -# From Paul Eggert (2015-09-23): +# From Paul Eggert (2019-08-28): # Transitions before 2015 are from timeanddate.com, which consulted # the Norfolk Island Museum and the Australian Bureau of Meteorology's # Norfolk Island station, and found no record of Norfolk observing DST # other than in 1974/5. See: # https://www.timeanddate.com/time/australia/norfolk-island.html +# However, disagree with timeanddate about the 1975-03-02 transition; +# timeanddate has 02:00 but 02:00s corresponds to what the NSW law said +# (thanks to Michael Deckers). + +# Norfolk started observing Australian DST in spring 2019. +# From Kyle Czech (2019-08-13): +# https://www.legislation.gov.au/Details/F2018L01702 +# From Michael Deckers (2019-08-14): +# https://www.legislation.gov.au/Details/F2019C00010 # Palau # See commentary for Micronesia.
--- a/make/data/tzdata/europe Mon Sep 09 17:27:04 2019 +0100 +++ b/make/data/tzdata/europe Wed Oct 23 15:35:04 2019 +0100 @@ -145,7 +145,7 @@ # position is 51° 28' 30" N, 0° 18' 45" W. The longitude should # be within about ±2". The Ordnance Survey grid reference is TQ172761. # -# [This yields GMTOFF = -0:01:15 for London LMT in the 18th century.] +# [This yields STDOFF = -0:01:15 for London LMT in the 18th century.] # From Paul Eggert (1993-11-18): # @@ -523,7 +523,7 @@ # # Use Europe/London for Jersey, Guernsey, and the Isle of Man. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/London -0:01:15 - LMT 1847 Dec 1 0:00s 0:00 GB-Eire %s 1968 Oct 27 1:00 - BST 1971 Oct 31 2:00u @@ -561,7 +561,7 @@ #Rule Eire 1990 1995 - Oct Sun>=22 1:00u -1:00 - #Rule Eire 1996 max - Oct lastSun 1:00u -1:00 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Dublin -0:25:00 - LMT 1880 Aug 2 -0:25:21 - DMT 1916 May 21 2:00s -0:25:21 1:00 IST 1916 Oct 1 2:00s @@ -760,7 +760,7 @@ # These are for backward compatibility with older versions. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone WET 0:00 EU WE%sT Zone CET 1:00 C-Eur CE%sT Zone MET 1:00 C-Eur ME%sT @@ -820,14 +820,14 @@ Rule Albania 1983 only - Apr 18 0:00 1:00 S Rule Albania 1983 only - Oct 1 0:00 0 - Rule Albania 1984 only - Apr 1 0:00 1:00 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Tirane 1:19:20 - LMT 1914 1:00 - CET 1940 Jun 16 1:00 Albania CE%sT 1984 Jul 1:00 EU CE%sT # Andorra -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Andorra 0:06:04 - LMT 1901 0:00 - WET 1946 Sep 30 1:00 - CET 1985 Mar 31 2:00 @@ -844,16 +844,21 @@ # Shanks & Pottenger give 02:00, the BEV 00:00. Go with the BEV, # and guess 02:00 for 1945-04-12. +# From Alois Triendl (2019-07-22): +# In 1946 the end of DST was on Monday, 7 October 1946, at 3:00 am. +# Shanks had this right. Source: Die Weltpresse, 5. Oktober 1946, page 5. + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Austria 1920 only - Apr 5 2:00s 1:00 S Rule Austria 1920 only - Sep 13 2:00s 0 - Rule Austria 1946 only - Apr 14 2:00s 1:00 S -Rule Austria 1946 1948 - Oct Sun>=1 2:00s 0 - +Rule Austria 1946 only - Oct 7 2:00s 0 - +Rule Austria 1947 1948 - Oct Sun>=1 2:00s 0 - Rule Austria 1947 only - Apr 6 2:00s 1:00 S Rule Austria 1948 only - Apr 18 2:00s 1:00 S Rule Austria 1980 only - Apr 6 0:00 1:00 S Rule Austria 1980 only - Sep 28 0:00 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Vienna 1:05:21 - LMT 1893 Apr 1:00 C-Eur CE%sT 1920 1:00 Austria CE%sT 1940 Apr 1 2:00s @@ -885,7 +890,7 @@ # Belarussian government decided against changing to winter time.... # http://eng.belta.by/all_news/society/Belarus-decides-against-adjusting-time-in-Russias-wake_i_76335.html # -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Minsk 1:50:16 - LMT 1880 1:50 - MMT 1924 May 2 # Minsk Mean Time 2:00 - EET 1930 Jun 21 @@ -898,15 +903,35 @@ # Belgium # -# From Paul Eggert (1997-07-02): +# From Michael Deckers (2019-08-25): +# The exposition in the web page +# https://www.bestor.be/wiki/index.php/Voyager_dans_le_temps._L%E2%80%99introduction_de_la_norme_de_Greenwich_en_Belgique +# gives several contemporary sources from which one can conclude that +# the switch in Europe/Brussels on 1892-05-01 was from 00:17:30 to 00:00:00. +# +# From Paul Eggert (2019-08-28): +# This quote helps explain the late-1914 situation: +# In early November 1914, the Germans imposed the time zone used in central +# Europe and forced the inhabitants to set their watches and public clocks +# sixty minutes ahead. Many were reluctant to accept "German time" and +# continued to use "Belgian time" among themselves. Reflecting the spirit of +# resistance that arose in the population, a song made fun of this change.... +# The song ended: +# Putting your clock forward +# Will but hasten the happy hour +# When we kick out the Boches! +# See: Pluvinage G. Brussels on German time. Cahiers Bruxellois - +# Brusselse Cahiers. 2014;XLVI(1E):15-38. +# https://www.cairn.info/revue-cahiers-bruxellois-2014-1E-page-15.htm +# +# Entries from 1914 through 1917 are taken from "De tijd in België" +# <https://www.astro.oma.be/GENERAL/INFO/nli001a.html>. # Entries from 1918 through 1991 are taken from: # Annuaire de L'Observatoire Royal de Belgique, # Avenue Circulaire, 3, B-1180 BRUXELLES, CLVIIe année, 1991 # (Imprimerie HAYEZ, s.p.r.l., Rue Fin, 4, 1080 BRUXELLES, MCMXC), # pp 8-9. -# LMT before 1892 was 0:17:30, according to the official journal of Belgium: -# Moniteur Belge, Samedi 30 Avril 1892, N.121. -# Thanks to Pascal Delmoitie for these references. +# Thanks to Pascal Delmoitie for the 1918/1991 references. # The 1918 rules are listed for completeness; they apply to unoccupied Belgium. # Assume Brussels switched to WET in 1918 when the armistice took effect. # @@ -949,9 +974,9 @@ Rule Belgium 1945 only - Sep 16 2:00s 0 - Rule Belgium 1946 only - May 19 2:00s 1:00 S Rule Belgium 1946 only - Oct 7 2:00s 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Brussels 0:17:30 - LMT 1880 - 0:17:30 - BMT 1892 May 1 12:00 # Brussels MT + 0:17:30 - BMT 1892 May 1 00:17:30 0:00 - WET 1914 Nov 8 1:00 - CET 1916 May 1 0:00 1:00 C-Eur CE%sT 1918 Nov 11 11:00u @@ -976,7 +1001,7 @@ Rule Bulg 1980 1982 - Apr Sat>=1 23:00 1:00 S Rule Bulg 1980 only - Sep 29 1:00 0 - Rule Bulg 1981 only - Sep 27 2:00 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Sofia 1:33:16 - LMT 1880 1:56:56 - IMT 1894 Nov 30 # Istanbul MT? 2:00 - EET 1942 Nov 2 3:00 @@ -1009,7 +1034,7 @@ Rule Czech 1946 1949 - Oct Sun>=1 2:00s 0 - Rule Czech 1947 1948 - Apr Sun>=15 2:00s 1:00 S Rule Czech 1949 only - Apr 9 2:00s 1:00 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Prague 0:57:44 - LMT 1850 0:57:44 - PMT 1891 Oct # Prague Mean Time 1:00 C-Eur CE%sT 1945 May 9 @@ -1071,7 +1096,7 @@ Rule Denmark 1948 only - May 9 2:00s 1:00 S Rule Denmark 1948 only - Aug 8 2:00s 0 - # -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Copenhagen 0:50:20 - LMT 1890 0:50:20 - CMT 1894 Jan 1 # Copenhagen MT 1:00 Denmark CE%sT 1942 Nov 2 2:00s @@ -1168,7 +1193,7 @@ Rule Thule 2007 max - Mar Sun>=8 2:00 1:00 D Rule Thule 2007 max - Nov Sun>=1 2:00 0 S # -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Danmarkshavn -1:14:40 - LMT 1916 Jul 28 -3:00 - -03 1980 Apr 6 2:00 -3:00 EU -03/-02 1996 @@ -1234,7 +1259,7 @@ # From Urmet Jänes (2002-03-28): # The legislative reference is Government decree No. 84 on 2002-02-21. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Tallinn 1:39:00 - LMT 1880 1:39:00 - TMT 1918 Feb # Tallinn Mean Time 1:00 C-Eur CE%sT 1919 Jul @@ -1297,7 +1322,7 @@ # Milne says Helsinki (Helsingfors) time was 1:39:49.2 (official document); # round to nearest. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Helsinki 1:39:49 - LMT 1878 May 31 1:39:49 - HMT 1921 May # Helsinki Mean Time 2:00 Finland EE%sT 1983 @@ -1387,7 +1412,7 @@ # but Howse quotes the actual French legislation as saying 0:09:21. # Go with Howse. Howse writes that the time in France was officially based # on PMT-0:09:21 until 1978-08-09, when the time base finally switched to UTC. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Paris 0:09:21 - LMT 1891 Mar 15 0:01 0:09:21 - PMT 1911 Mar 11 0:01 # Paris MT # Shanks & Pottenger give 1940 Jun 14 0:00; go with Excoffier and Le Corre. @@ -1435,7 +1460,7 @@ Rule SovietZone 1945 only - Sep 24 3:00 1:00 S Rule SovietZone 1945 only - Nov 18 2:00s 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Berlin 0:53:28 - LMT 1893 Apr 1:00 C-Eur CE%sT 1945 May 24 2:00 1:00 SovietZone CE%sT 1946 @@ -1463,7 +1488,7 @@ # is in Europe. Our reference location Tbilisi is in the Asian part. # Gibraltar -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Gibraltar -0:21:24 - LMT 1880 Aug 2 0:00s 0:00 GB-Eire %s 1957 Apr 14 2:00 1:00 - CET 1982 @@ -1494,7 +1519,7 @@ Rule Greece 1979 only - Sep 29 2:00 0 - Rule Greece 1980 only - Apr 1 0:00 1:00 S Rule Greece 1980 only - Sep 28 0:00 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Athens 1:34:52 - LMT 1895 Sep 14 1:34:52 - AMT 1916 Jul 28 0:01 # Athens MT 2:00 Greece EE%sT 1941 Apr 30 @@ -1531,7 +1556,7 @@ Rule Hungary 1957 only - Jun Sun>=1 1:00 1:00 S Rule Hungary 1957 only - Sep lastSun 3:00 0 - Rule Hungary 1980 only - Apr 6 1:00 1:00 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Budapest 1:16:20 - LMT 1890 Oct 1:00 C-Eur CE%sT 1918 1:00 Hungary CE%sT 1941 Apr 8 @@ -1592,7 +1617,7 @@ Rule Iceland 1949 only - Oct 30 1:00s 0 - Rule Iceland 1950 1966 - Oct Sun>=22 1:00s 0 - Rule Iceland 1967 only - Oct 29 1:00s 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Atlantic/Reykjavik -1:28 - LMT 1908 -1:00 Iceland -01/+00 1968 Apr 7 1:00s 0:00 - GMT @@ -1606,6 +1631,25 @@ # But these events all occurred before the 1970 cutoff, # so record only the time in Rome. # +# From Stephen Trainor (2019-05-06): +# http://www.ac-ilsestante.it/MERIDIANE/ora_legale/ORA_LEGALE_ESTIVA_IN_ITALIA.htm +# ... the [1866] law went into effect on 12 December 1866, rather than +# the date of the decree (22 Sep 1866) +# https://web.archive.org/web/20070824155341/http://www.iav.it/planetario/didastro/didastro/english.htm +# ... "In Italy in 1866 there were 6 railway times (Torino, Verona, Firenze, +# Roma, Napoli, Palermo). On that year it was decided to unify them, adopting +# the average time of Rome (even if this city was not yet part of the +# kingdom). On the 12th December 1866, on the starting of the winter time +# table, it took effect in the railways, the post office and the telegraph, +# not only for the internal service but also for the public.... Milano set +# the public watches on the Rome time on the same day (12th December 1866), +# Torino and Bologna on the 1st January 1867, Venezia the 1st May 1880 and the +# last city was Cagliari in 1886." +# +# From Luigi Rosa (2019-05-07): +# this is the scan of the decree: +# http://www.radiomarconi.com/marconi/filopanti/1866c.jpg +# # From Michael Deckers (2016-10-24): # http://www.ac-ilsestante.it/MERIDIANE/ora_legale quotes a law of 1893-08-10 # ... [translated as] "The preceding dispositions will enter into @@ -1616,6 +1660,7 @@ # The authoritative source for time in Italy is the national metrological # institute, which has a summary page of historical DST data at # http://www.inrim.it/res/tf/ora_legale_i.shtml +# [now at http://oldsite.inrim.it/res/tf/ora_legale_i.shtml as of 2017] # (2016-10-24): # http://www.renzobaldini.it/le-ore-legali-in-italia/ # has still different data for 1944. It divides Italy in two, as @@ -1630,6 +1675,13 @@ # advanced to sixty minutes later starting at hour two on 1944-04-02; ... # Starting at hour three on the date 1944-09-17 standard time will be resumed. # +# From Alois Triendl (2019-07-02): +# I spent 6 Euros to buy two archive copies of Il Messaggero, a Roman paper, +# for 1 and 2 April 1944. The edition of 2 April has this note: "Tonight at 2 +# am, put forward the clock by one hour. Remember that in the night between +# today and Monday the 'ora legale' will come in force again." That makes it +# clear that in Rome the change was on Monday, 3 April 1944 at 2 am. +# # From Paul Eggert (2016-10-27): # Go with INRiM for DST rules, except as corrected by Inglis for 1944 # for the Kingdom of Italy. This is consistent with Renzo Baldini. @@ -1679,8 +1731,8 @@ Rule Italy 1977 1979 - May Sun>=22 0:00s 1:00 S Rule Italy 1978 only - Oct 1 0:00s 0 - Rule Italy 1979 only - Sep 30 0:00s 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Europe/Rome 0:49:56 - LMT 1866 Sep 22 +# Zone NAME STDOFF RULES FORMAT [UNTIL] +Zone Europe/Rome 0:49:56 - LMT 1866 Dec 12 0:49:56 - RMT 1893 Oct 31 23:49:56 # Rome Mean 1:00 Italy CE%sT 1943 Sep 10 1:00 C-Eur CE%sT 1944 Jun 4 @@ -1755,7 +1807,7 @@ # Byalokoz 1919 says Latvia was 1:36:34. # Go with Byalokoz. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Riga 1:36:34 - LMT 1880 1:36:34 - RMT 1918 Apr 15 2:00 # Riga MT 1:36:34 1:00 LST 1918 Sep 16 3:00 # Latvian ST @@ -1777,15 +1829,10 @@ # From Paul Eggert (2013-09-09): # Shanks & Pottenger say Vaduz is like Zurich. -# From Alois Treindl (2013-09-18): -# http://www.eliechtensteinensia.li/LIJ/1978/1938-1978/1941.pdf -# ... confirms on p. 6 that Liechtenstein followed Switzerland in 1941 and 1942. -# I ... translate only the last two paragraphs: -# ... during second world war, in the years 1941 and 1942, Liechtenstein -# introduced daylight saving time, adapting to Switzerland. From 1943 on -# central European time was in force throughout the year. -# From a report of the duke's government to the high council, -# regarding the introduction of a time law, of 31 May 1977. +# From Alois Treindl (2019-07-04): +# I was able to access the online archive of the Vaduz paper Vaterland ... +# I could confirm from the paper that Liechtenstein did in fact follow +# the same DST in 1941 and 1942 as Switzerland did. Link Europe/Zurich Europe/Vaduz @@ -1825,7 +1872,7 @@ # http://www.lrvk.lt/nut/11/n1749.htm -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Vilnius 1:41:16 - LMT 1880 1:24:00 - WMT 1917 # Warsaw Mean Time 1:35:36 - KMT 1919 Oct 10 # Kaunas Mean Time @@ -1869,7 +1916,7 @@ Rule Lux 1927 only - Apr 9 23:00 1:00 S Rule Lux 1928 only - Apr 14 23:00 1:00 S Rule Lux 1929 only - Apr 20 23:00 1:00 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Luxembourg 0:24:36 - LMT 1904 Jun 1:00 Lux CE%sT 1918 Nov 25 0:00 Lux WE%sT 1929 Oct 6 2:00s @@ -1894,7 +1941,7 @@ Rule Malta 1975 1979 - Apr Sun>=15 2:00 1:00 S Rule Malta 1975 1980 - Sep Sun>=15 2:00 0 - Rule Malta 1980 only - Mar 31 2:00 1:00 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Malta 0:58:04 - LMT 1893 Nov 2 0:00s # Valletta 1:00 Italy CE%sT 1973 Mar 31 1:00 Malta CE%sT 1981 @@ -1963,7 +2010,7 @@ Rule Moldova 1997 max - Mar lastSun 2:00 1:00 S Rule Moldova 1997 max - Oct lastSun 3:00 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Chisinau 1:55:20 - LMT 1880 1:55 - CMT 1918 Feb 15 # Chisinau MT 1:44:24 - BMT 1931 Jul 24 # Bucharest MT @@ -1979,7 +2026,7 @@ # Monaco # Shanks & Pottenger give 0:09:20 for Paris Mean Time; go with Howse's # more precise 0:09:21. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Monaco 0:29:32 - LMT 1891 Mar 15 0:09:21 - PMT 1911 Mar 11 # Paris Mean Time 0:00 France WE%sT 1945 Sep 16 3:00 @@ -2054,8 +2101,8 @@ Rule Neth 1945 only - Sep 16 2:00s 0 - # # Amsterdam Mean Time was +00:19:32.13, but the .13 is omitted -# below because the current format requires GMTOFF to be an integer. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# below because the current format requires STDOFF to be an integer. +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Amsterdam 0:19:32 - LMT 1835 0:19:32 Neth %s 1937 Jul 1 0:20 Neth +0020/+0120 1940 May 16 0:00 @@ -2074,7 +2121,7 @@ Rule Norway 1959 1964 - Mar Sun>=15 2:00s 1:00 S Rule Norway 1959 1965 - Sep Sun>=15 2:00s 0 - Rule Norway 1965 only - Apr 25 2:00s 1:00 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Oslo 0:43:00 - LMT 1895 Jan 1 1:00 Norway CE%sT 1940 Aug 10 23:00 1:00 C-Eur CE%sT 1945 Apr 2 2:00 @@ -2165,7 +2212,7 @@ Rule Poland 1960 only - Apr 3 1:00s 1:00 S Rule Poland 1961 1964 - May lastSun 1:00s 1:00 S Rule Poland 1962 1964 - Sep lastSun 1:00s 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Warsaw 1:24:00 - LMT 1880 1:24:00 - WMT 1915 Aug 5 # Warsaw Mean Time 1:00 C-Eur CE%sT 1918 Sep 16 3:00 @@ -2270,7 +2317,7 @@ Rule Port 1981 1982 - Mar lastSun 1:00s 1:00 S Rule Port 1983 only - Mar lastSun 2:00s 1:00 S # -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Lisbon -0:36:45 - LMT 1884 -0:36:45 - LMT 1912 Jan 1 0:00u # Lisbon MT 0:00 Port WE%sT 1966 Apr 3 2:00 @@ -2329,7 +2376,7 @@ Rule Romania 1980 only - Sep lastSun 1:00 0 - Rule Romania 1991 1993 - Mar lastSun 0:00s 1:00 S Rule Romania 1991 1993 - Sep lastSun 0:00s 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Bucharest 1:44:24 - LMT 1891 Oct 1:44:24 - BMT 1931 Jul 24 # Bucharest MT 2:00 Romania EE%sT 1981 Mar 29 2:00s @@ -2493,6 +2540,12 @@ # Europe/Kaliningrad covers... # 39 RU-KGD Kaliningrad Oblast +# From Paul Eggert (2019-07-25): +# Although Shanks lists 1945-01-01 as the date for transition from +# +01/+02 to +02/+03, more likely this is a placeholder. Guess that +# the transition occurred at 1945-04-10 00:00, which is about when +# Königsberg surrendered to Soviet troops. (Thanks to Alois Triendl.) + # From Paul Eggert (2016-03-18): # The 1989 transition is from USSR act No. 227 (1989-03-14). @@ -2509,8 +2562,8 @@ # Moscow on 1991-11-03, switched to Moscow-1 on 1992-01-19. Zone Europe/Kaliningrad 1:22:00 - LMT 1893 Apr - 1:00 C-Eur CE%sT 1945 - 2:00 Poland CE%sT 1946 + 1:00 C-Eur CE%sT 1945 Apr 10 + 2:00 Poland EE%sT 1946 Apr 7 3:00 Russia MSK/MSD 1989 Mar 26 2:00s 2:00 Russia EE%sT 2011 Mar 27 2:00s 3:00 - +03 2014 Oct 26 2:00s @@ -3368,7 +3421,7 @@ # See Europe/Rome. # Serbia -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Belgrade 1:22:00 - LMT 1884 1:00 - CET 1941 Apr 18 23:00 1:00 C-Eur CE%sT 1945 @@ -3474,7 +3527,7 @@ Rule SpainAfrica 1977 only - Sep 28 0:00 0 - Rule SpainAfrica 1978 only - Jun 1 0:00 1:00 S Rule SpainAfrica 1978 only - Aug 4 0:00 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Madrid -0:14:44 - LMT 1900 Dec 31 23:45:16 0:00 Spain WE%sT 1940 Mar 16 23:00 1:00 Spain CE%sT 1979 @@ -3542,7 +3595,7 @@ # # Source: The newspaper "Dagens Nyheter", 1916-10-01, page 7 upper left. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Stockholm 1:12:12 - LMT 1879 Jan 1 1:00:14 - SET 1900 Jan 1 # Swedish Time 1:00 - CET 1916 May 14 23:00 @@ -3645,7 +3698,7 @@ # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Swiss 1941 1942 - May Mon>=1 1:00 1:00 S Rule Swiss 1941 1942 - Oct Mon>=1 2:00 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Zurich 0:34:08 - LMT 1853 Jul 16 # See above comment. 0:29:46 - BMT 1894 Jun # Bern Mean Time 1:00 Swiss CE%sT 1981 @@ -3653,20 +3706,75 @@ # Turkey +# From Alois Treindl (2019-08-12): +# http://www.astrolojidergisi.com/yazsaati.htm has researched the time zone +# history of Turkey, based on newspaper archives and official documents. +# From Paul Eggert (2019-08-28): +# That source (Oya Vulaş, "Türkiye'de Yaz Saati Uygulamaları") +# is used for 1940/1972, where it seems more reliable than our other +# sources. + +# From Kıvanç Yazan (2019-08-12): +# http://www.resmigazete.gov.tr/arsiv/14539.pdf#page=24 +# 1973-06-03 01:00 -> 02:00, 1973-11-04 02:00 -> 01:00 +# +# http://www.resmigazete.gov.tr/arsiv/14829.pdf#page=1 +# 1974-03-31 02:00 -> 03:00, 1974-11-03 02:00 -> 01:00 +# +# http://www.resmigazete.gov.tr/arsiv/15161.pdf#page=1 +# 1975-03-22 02:00 -> 03:00, 1975-11-02 02:00 -> 01:00 +# +# http://www.resmigazete.gov.tr/arsiv/15535_1.pdf#page=1 +# 1976-03-21 02:00 -> 03:00, 1976-10-31 02:00 -> 01:00 +# +# http://www.resmigazete.gov.tr/arsiv/15778.pdf#page=5 +# 1977-04-03 02:00 -> 03:00, 1977-10-16 02:00 -> 01:00, +# 1978-04-02 02:00 -> 03:00 (not applied, see below) +# 1978-10-15 02:00 -> 01:00 (not applied, see below) +# 1979-04-01 02:00 -> 03:00 (not applied, see below) +# 1979-10-14 02:00 -> 01:00 (not applied, see below) +# +# http://www.resmigazete.gov.tr/arsiv/16245.pdf#page=17 +# This cancels the previous decision, and repeats it only for 1978. +# 1978-04-02 02:00 -> 03:00, 1978-10-15 02:00 -> 01:00 +# (not applied due to standard TZ change below) +# +# http://www.resmigazete.gov.tr/arsiv/16331.pdf#page=3 +# This decision changes the default longitude for Turkish time zone from 30 +# degrees East to 45 degrees East. This means a standard TZ change, from +2 +# to +3. This is published & applied on 1978-06-29. At that time, Turkey was +# already on summer time (already on 45E). Hence, this new law just meant an +# "continuous summer time". Note that this was reversed in a few years. +# +# http://www.resmigazete.gov.tr/arsiv/18119_1.pdf#page=1 +# 1983-07-31 02:00 -> 03:00 (note that this jumps TZ to +4) +# 1983-10-02 02:00 -> 01:00 (back to +3) +# +# http://www.resmigazete.gov.tr/arsiv/18561.pdf (page 1 and 34) +# At this time, Turkey is still on +3 with no spring-forward on early +# 1984. This decision is published on 10/31/1984. Page 1 declares +# the decision of reverting the "default longitude change". So the +# standard time should go back to +3 (30E). And page 34 explains when +# that will happen: 1984-11-01 02:00 -> 01:00. You can think of this +# as "end of continuous summer time, change of standard time zone". +# +# http://www.resmigazete.gov.tr/arsiv/18713.pdf#page=1 +# 1985-04-20 01:00 -> 02:00, 1985-09-28 02:00 -> 01:00 + # From Kıvanç Yazan (2016-09-25): # 1) For 1986-2006, DST started at 01:00 local and ended at 02:00 local, with # no exceptions. # 2) 1994's lastSun was overridden with Mar 20 ... # Here are official papers: -# http://www.resmigazete.gov.tr/arsiv/19032.pdf - page 2 for 1986 -# http://www.resmigazete.gov.tr/arsiv/19400.pdf - page 4 for 1987 -# http://www.resmigazete.gov.tr/arsiv/19752.pdf - page 15 for 1988 -# http://www.resmigazete.gov.tr/arsiv/20102.pdf - page 6 for 1989 -# http://www.resmigazete.gov.tr/arsiv/20464.pdf - page 1 for 1990 - 1992 -# http://www.resmigazete.gov.tr/arsiv/21531.pdf - page 15 for 1993 - 1995 -# http://www.resmigazete.gov.tr/arsiv/21879.pdf - page 1 for overriding 1994 -# http://www.resmigazete.gov.tr/arsiv/22588.pdf - page 1 for 1996, 1997 -# http://www.resmigazete.gov.tr/arsiv/23286.pdf - page 10 for 1998 - 2000 +# http://www.resmigazete.gov.tr/arsiv/19032.pdf#page=2 for 1986 +# http://www.resmigazete.gov.tr/arsiv/19400.pdf#page=4 for 1987 +# http://www.resmigazete.gov.tr/arsiv/19752.pdf#page=15 for 1988 +# http://www.resmigazete.gov.tr/arsiv/20102.pdf#page=6 for 1989 +# http://www.resmigazete.gov.tr/arsiv/20464.pdf#page=1 for 1990 - 1992 +# http://www.resmigazete.gov.tr/arsiv/21531.pdf#page=15 for 1993 - 1995 +# http://www.resmigazete.gov.tr/arsiv/21879.pdf#page=1 for overriding 1994 +# http://www.resmigazete.gov.tr/arsiv/22588.pdf#page=1 for 1996, 1997 +# http://www.resmigazete.gov.tr/arsiv/23286.pdf#page=10 for 1998 - 2000 # http://www.resmigazete.gov.tr/eskiler/2001/03/20010324.htm#2 - for 2001 # http://www.resmigazete.gov.tr/eskiler/2002/03/20020316.htm#2 - for 2002-2006 # From Paul Eggert (2016-09-25): @@ -3750,56 +3858,46 @@ Rule Turkey 1924 only - May 13 0:00 1:00 S Rule Turkey 1924 1925 - Oct 1 0:00 0 - Rule Turkey 1925 only - May 1 0:00 1:00 S -Rule Turkey 1940 only - Jun 30 0:00 1:00 S -Rule Turkey 1940 only - Oct 5 0:00 0 - +Rule Turkey 1940 only - Jul 1 0:00 1:00 S +Rule Turkey 1940 only - Oct 6 0:00 0 - Rule Turkey 1940 only - Dec 1 0:00 1:00 S Rule Turkey 1941 only - Sep 21 0:00 0 - Rule Turkey 1942 only - Apr 1 0:00 1:00 S -# Whitman omits the next two transition and gives 1945 Oct 1; -# go with Shanks & Pottenger. -Rule Turkey 1942 only - Nov 1 0:00 0 - -Rule Turkey 1945 only - Apr 2 0:00 1:00 S Rule Turkey 1945 only - Oct 8 0:00 0 - Rule Turkey 1946 only - Jun 1 0:00 1:00 S Rule Turkey 1946 only - Oct 1 0:00 0 - Rule Turkey 1947 1948 - Apr Sun>=16 0:00 1:00 S -Rule Turkey 1947 1950 - Oct Sun>=2 0:00 0 - +Rule Turkey 1947 1951 - Oct Sun>=2 0:00 0 - Rule Turkey 1949 only - Apr 10 0:00 1:00 S -Rule Turkey 1950 only - Apr 19 0:00 1:00 S +Rule Turkey 1950 only - Apr 16 0:00 1:00 S Rule Turkey 1951 only - Apr 22 0:00 1:00 S -Rule Turkey 1951 only - Oct 8 0:00 0 - +# DST for 15 months; unusual but we'll let it pass. Rule Turkey 1962 only - Jul 15 0:00 1:00 S -Rule Turkey 1962 only - Oct 8 0:00 0 - +Rule Turkey 1963 only - Oct 30 0:00 0 - Rule Turkey 1964 only - May 15 0:00 1:00 S Rule Turkey 1964 only - Oct 1 0:00 0 - -Rule Turkey 1970 1972 - May Sun>=2 0:00 1:00 S -Rule Turkey 1970 1972 - Oct Sun>=2 0:00 0 - Rule Turkey 1973 only - Jun 3 1:00 1:00 S -Rule Turkey 1973 only - Nov 4 3:00 0 - +Rule Turkey 1973 1976 - Oct Sun>=31 2:00 0 - Rule Turkey 1974 only - Mar 31 2:00 1:00 S -Rule Turkey 1974 only - Nov 3 5:00 0 - -Rule Turkey 1975 only - Mar 30 0:00 1:00 S -Rule Turkey 1975 1976 - Oct lastSun 0:00 0 - -Rule Turkey 1976 only - Jun 1 0:00 1:00 S -Rule Turkey 1977 1978 - Apr Sun>=1 0:00 1:00 S -Rule Turkey 1977 only - Oct 16 0:00 0 - -Rule Turkey 1979 1980 - Apr Sun>=1 3:00 1:00 S -Rule Turkey 1979 1982 - Oct Mon>=11 0:00 0 - -Rule Turkey 1981 1982 - Mar lastSun 3:00 1:00 S -Rule Turkey 1983 only - Jul 31 0:00 1:00 S -Rule Turkey 1983 only - Oct 2 0:00 0 - -Rule Turkey 1985 only - Apr 20 0:00 1:00 S -Rule Turkey 1985 only - Sep 28 0:00 0 - +Rule Turkey 1975 only - Mar 22 2:00 1:00 S +Rule Turkey 1976 only - Mar 21 2:00 1:00 S +Rule Turkey 1977 1978 - Apr Sun>=1 2:00 1:00 S +Rule Turkey 1977 1978 - Oct Sun>=15 2:00 0 - +Rule Turkey 1978 only - Jun 29 0:00 0 - +Rule Turkey 1983 only - Jul 31 2:00 1:00 S +Rule Turkey 1983 only - Oct 2 2:00 0 - +Rule Turkey 1985 only - Apr 20 1:00s 1:00 S +Rule Turkey 1985 only - Sep 28 1:00s 0 - Rule Turkey 1986 1993 - Mar lastSun 1:00s 1:00 S Rule Turkey 1986 1995 - Sep lastSun 1:00s 0 - Rule Turkey 1994 only - Mar 20 1:00s 1:00 S Rule Turkey 1995 2006 - Mar lastSun 1:00s 1:00 S Rule Turkey 1996 2006 - Oct lastSun 1:00s 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Istanbul 1:55:52 - LMT 1880 1:56:56 - IMT 1910 Oct # Istanbul Mean Time? - 2:00 Turkey EE%sT 1978 Oct 15 - 3:00 Turkey +03/+04 1985 Apr 20 + 2:00 Turkey EE%sT 1978 Jun 29 + 3:00 Turkey +03/+04 1984 Nov 1 2:00 2:00 Turkey EE%sT 2007 2:00 EU EE%sT 2011 Mar 27 1:00u 2:00 - EET 2011 Mar 28 1:00u @@ -3892,16 +3990,8 @@ # controversial, and some day "Kyiv" may become substantially more popular in # English; in the meantime, stick with the traditional English "Kiev" as that # means less disruption for our users. -# -# Anyway, none of the common English-language spellings (Kiev, Kyiv, Kieff, -# Kijeff, Kijev, Kiyef, Kiyeff) do justice to the common pronunciation in -# Ukrainian, namely [ˈkɪjiu̯] (IPA). This pronunciation has nothing like an -# English "v" or "f", and instead trails off with what an English-speaker -# would call a demure "oo" sound, and it would would be better anglicized as -# "Kuiyu". Here's a sound file, if you would like to do as the Kuiyuvians do: -# https://commons.wikimedia.org/wiki/File:Uk-Київ.ogg - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] + +# Zone NAME STDOFF RULES FORMAT [UNTIL] # This represents most of Ukraine. See above for the spelling of "Kiev". Zone Europe/Kiev 2:02:04 - LMT 1880 2:02:04 - KMT 1924 May 2 # Kiev Mean Time
--- a/make/data/tzdata/factory Mon Sep 09 17:27:04 2019 +0100 +++ b/make/data/tzdata/factory Wed Oct 23 15:35:04 2019 +0100 @@ -31,5 +31,5 @@ # time zone abbreviation "-00", indicating that the actual time zone # is unknown. -# Zone NAME GMTOFF RULES FORMAT +# Zone NAME STDOFF RULES FORMAT Zone Factory 0 - -00
--- a/make/data/tzdata/leapseconds Mon Sep 09 17:27:04 2019 +0100 +++ b/make/data/tzdata/leapseconds Wed Oct 23 15:35:04 2019 +0100 @@ -26,36 +26,39 @@ # This file is in the public domain. # This file is generated automatically from the data in the public-domain -# leap-seconds.list file, which can be copied from +# NIST format leap-seconds.list file, which can be copied from # <ftp://ftp.nist.gov/pub/time/leap-seconds.list> -# or <ftp://ftp.boulder.nist.gov/pub/time/leap-seconds.list> -# or <ftp://tycho.usno.navy.mil/pub/ntp/leap-seconds.list>. +# or <ftp://ftp.boulder.nist.gov/pub/time/leap-seconds.list>. # For more about leap-seconds.list, please see # The NTP Timescale and Leap Seconds # <https://www.eecis.udel.edu/~mills/leap.html>. -# The International Earth Rotation and Reference Systems Service +# The rules for leap seconds are specified in Annex 1 (Time scales) of: +# Standard-frequency and time-signal emissions. +# International Telecommunication Union - Radiocommunication Sector +# (ITU-R) Recommendation TF.460-6 (02/2002) +# <https://www.itu.int/rec/R-REC-TF.460-6-200202-I/>. +# The International Earth Rotation and Reference Systems Service (IERS) # periodically uses leap seconds to keep UTC to within 0.9 s of UT1 -# (which measures the true angular orientation of the earth in space) +# (a proxy for Earth's angle in space as measured by astronomers) # and publishes leap second data in a copyrighted file # <https://hpiers.obspm.fr/iers/bul/bulc/Leap_Second.dat>. # See: Levine J. Coordinated Universal Time and the leap second. # URSI Radio Sci Bull. 2016;89(4):30-6. doi:10.23919/URSIRSB.2016.7909995 # <https://ieeexplore.ieee.org/document/7909995>. -# There were no leap seconds before 1972, because the official mechanism -# accounting for the discrepancy between atomic time and the earth's rotation -# did not exist. The first ("1 Jan 1972") data line in leap-seconds.list +# There were no leap seconds before 1972, as no official mechanism +# accounted for the discrepancy between atomic time (TAI) and the earth's +# rotation. The first ("1 Jan 1972") data line in leap-seconds.list # does not denote a leap second; it denotes the start of the current definition # of UTC. -# The correction (+ or -) is made at the given time, so lines -# will typically look like: -# Leap YEAR MON DAY 23:59:60 + R/S -# or -# Leap YEAR MON DAY 23:59:59 - R/S - -# If the leap second is Rolling (R) the given time is local time (unused here). +# All leap-seconds are Stationary (S) at the given UTC time. +# The correction (+ or -) is made at the given time, so in the unlikely +# event of a negative leap second, a line would look like this: +# Leap YEAR MON DAY 23:59:59 - S +# Typical lines look like this: +# Leap YEAR MON DAY 23:59:60 + S Leap 1972 Jun 30 23:59:60 + S Leap 1972 Dec 31 23:59:60 + S Leap 1973 Dec 31 23:59:60 + S @@ -85,8 +88,8 @@ Leap 2016 Dec 31 23:59:60 + S # POSIX timestamps for the data in this file: -#updated 1467936000 -#expires 1577491200 +#updated 1467936000 (2016-07-08 00:00:00 UTC) +#expires 1593302400 (2020-06-28 00:00:00 UTC) -# Updated through IERS Bulletin C57 -# File expires on: 28 December 2019 +# Updated through IERS Bulletin C58 +# File expires on: 28 June 2020
--- a/make/data/tzdata/northamerica Mon Sep 09 17:27:04 2019 +0100 +++ b/make/data/tzdata/northamerica Wed Oct 23 15:35:04 2019 +0100 @@ -116,10 +116,33 @@ # was the first nationwide legal time standard, and apparently # time was just called "Standard Time" or "Daylight Saving Time". -# From Arthur David Olson: -# US Daylight Saving Time ended on the last Sunday of *October* in 1974. -# See, for example, the front page of the Saturday, 1974-10-26 -# and Sunday, 1974-10-27 editions of the Washington Post. +# From Paul Eggert (2019-06-04): +# Here is the legal basis for the US federal rules. +# * Public Law 65-106 (1918-03-19) implemented standard and daylight saving +# time for the first time across the US, springing forward on March's last +# Sunday and falling back on October's last Sunday. +# https://www.loc.gov/law/help/statutes-at-large/65th-congress/session-2/c65s2ch24.pdf +# * Public Law 66-40 (1919-08-20) repealed DST on October 1919's last Sunday. +# https://www.loc.gov/law/help/statutes-at-large/66th-congress/session-1/c66s1ch51.pdf +# * Public Law 77-403 (1942-01-20) started wartime DST on 1942-02-09. +# https://www.loc.gov/law/help/statutes-at-large/77th-congress/session-2/c77s2ch7.pdf +# * Public Law 79-187 (1945-09-25) ended wartime DST on 1945-09-30. +# https://www.loc.gov/law/help/statutes-at-large/79th-congress/session-1/c79s1ch388.pdf +# * Public Law 89-387 (1966-04-13) reinstituted a national standard for DST, +# from April's last Sunday to October's last Sunday, effective 1967. +# https://www.govinfo.gov/content/pkg/STATUTE-80/pdf/STATUTE-80-Pg107.pdf +# * Public Law 93-182 (1973-12-15) moved the 1974 spring-forward to 01-06. +# https://www.govinfo.gov/content/pkg/STATUTE-87/pdf/STATUTE-87-Pg707.pdf +# * Public Law 93-434 (1974-10-05) moved the 1975 spring-forward to +# February's last Sunday. +# https://www.govinfo.gov/content/pkg/STATUTE-88/pdf/STATUTE-88-Pg1209.pdf +# * Public Law 99-359 (1986-07-08) moved the spring-forward to April's first +# Sunday. +# https://www.govinfo.gov/content/pkg/STATUTE-100/pdf/STATUTE-100-Pg764.pdf +# * Public Law 109-58 (2005-08-08), effective 2007, moved the spring-forward +# to March's second Sunday and the fall-back to November's first Sunday. +# https://www.govinfo.gov/content/pkg/PLAW-109publ58/pdf/PLAW-109publ58.pdf +# All transitions are at 02:00 local time. # From Arthur David Olson: # Before the Uniform Time Act of 1966 took effect in 1967, observance of @@ -175,11 +198,11 @@ Rule US 1918 1919 - Oct lastSun 2:00 0 S Rule US 1942 only - Feb 9 2:00 1:00 W # War Rule US 1945 only - Aug 14 23:00u 1:00 P # Peace -Rule US 1945 only - Sep lastSun 2:00 0 S +Rule US 1945 only - Sep 30 2:00 0 S Rule US 1967 2006 - Oct lastSun 2:00 0 S Rule US 1967 1973 - Apr lastSun 2:00 1:00 D Rule US 1974 only - Jan 6 2:00 1:00 D -Rule US 1975 only - Feb 23 2:00 1:00 D +Rule US 1975 only - Feb lastSun 2:00 1:00 D Rule US 1976 1986 - Apr lastSun 2:00 1:00 D Rule US 1987 2006 - Apr Sun>=1 2:00 1:00 D Rule US 2007 max - Mar Sun>=8 2:00 1:00 D @@ -196,7 +219,7 @@ # increase the chances that they'll actually get compiled and to # avoid the need to duplicate the US rules in another file. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone EST -5:00 - EST Zone MST -7:00 - MST Zone HST -10:00 - HST @@ -353,7 +376,7 @@ Rule NYC 1921 1966 - Apr lastSun 2:00 1:00 D Rule NYC 1921 1954 - Sep lastSun 2:00 0 S Rule NYC 1955 1966 - Oct lastSun 2:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/New_York -4:56:02 - LMT 1883 Nov 18 12:03:58 -5:00 US E%sT 1920 -5:00 NYC E%sT 1942 @@ -406,6 +429,31 @@ # From Paul Eggert (2015-12-25): # Assume this practice predates 1970, so Fort Pierre can use America/Chicago. +# From Paul Eggert (2015-04-06): +# In 1950s Nashville a public clock had dueling faces, one for conservatives +# and the other for liberals; the two sides didn't agree about the time of day. +# I haven't found a photo of this clock, nor have I tracked down the TIME +# magazine report cited below, but here's the story as told by the late +# American journalist John Seigenthaler, who was there: +# +# "The two [newspaper] owners held strongly contrasting political and +# ideological views. Evans was a New South liberal, Stahlman an Old South +# conservative, and their two papers frequently clashed editorially, often on +# the same day.... In the 1950s as the state legislature was grappling with +# the question of whether to approve daylight saving time for the entire state, +# TIME magazine reported: +# +# "'The Nashville Banner and The Nashville Tennessean rarely agree on anything +# but the time of day - and last week they couldn't agree on that.' +# +# "It was all too true. The clock on the front of the building had two faces - +# The Tennessean side of the building facing west, the other, east. When it +# was high noon Banner time, it was 11 a.m. Tennessean time." +# +# Seigenthaler J. For 100 years, Tennessean had it covered. +# The Tennessean 2007-05-11, republished 2015-04-06. +# https://www.tennessean.com/story/insider/extras/2015/04/06/archives-seigenthaler-for-100-years-the-tennessean-had-it-covered/25348545/ + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER Rule Chicago 1920 only - Jun 13 2:00 1:00 D Rule Chicago 1920 1921 - Oct lastSun 2:00 0 S @@ -413,7 +461,7 @@ Rule Chicago 1922 1966 - Apr lastSun 2:00 1:00 D Rule Chicago 1922 1954 - Sep lastSun 2:00 0 S Rule Chicago 1955 1966 - Oct lastSun 2:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Chicago -5:50:36 - LMT 1883 Nov 18 12:09:24 -6:00 US C%sT 1920 -6:00 Chicago C%sT 1936 Mar 1 2:00 @@ -481,7 +529,7 @@ Rule Denver 1921 only - May 22 2:00 0 S Rule Denver 1965 1966 - Apr lastSun 2:00 1:00 D Rule Denver 1965 1966 - Oct lastSun 2:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Denver -6:59:56 - LMT 1883 Nov 18 12:00:04 -7:00 US M%sT 1920 -7:00 Denver M%sT 1942 @@ -534,7 +582,7 @@ Rule CA 1950 1966 - Apr lastSun 1:00 1:00 D Rule CA 1950 1961 - Sep lastSun 2:00 0 S Rule CA 1962 1966 - Oct lastSun 2:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Los_Angeles -7:52:58 - LMT 1883 Nov 18 12:07:02 -8:00 US P%sT 1946 -8:00 CA P%sT 1967 @@ -642,7 +690,7 @@ # So they won't be waiting for Alaska to join them on 2019-03-10, but will # rather change their clocks twice in seven weeks. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Juneau 15:02:19 - LMT 1867 Oct 19 15:33:32 -8:57:41 - LMT 1900 Aug 20 12:00 -8:00 - PST 1942 @@ -762,7 +810,7 @@ # Note that 1933-05-21 was a Sunday. # We're left to guess the time of day when Act 163 was approved; guess noon. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Honolulu -10:31:26 - LMT 1896 Jan 13 12:00 -10:30 - HST 1933 Apr 30 2:00 -10:30 1:00 HDT 1933 May 21 12:00 @@ -792,7 +840,7 @@ # Shanks says the 1944 experiment came to an end on 1944-03-17. # Go with the Arizona State Library instead. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Phoenix -7:28:18 - LMT 1883 Nov 18 11:31:42 -7:00 US M%sT 1944 Jan 1 0:01 -7:00 - MST 1944 Apr 1 0:01 @@ -818,7 +866,7 @@ # quarter of Idaho county) and eastern Oregon (most of Malheur County) # switched four weeks late in 1974. # -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Boise -7:44:49 - LMT 1883 Nov 18 12:15:11 -8:00 US P%sT 1923 May 13 2:00 -7:00 US M%sT 1974 @@ -890,7 +938,7 @@ Rule Indianapolis 1941 only - Jun 22 2:00 1:00 D Rule Indianapolis 1941 1954 - Sep lastSun 2:00 0 S Rule Indianapolis 1946 1954 - Apr lastSun 2:00 1:00 D -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Indiana/Indianapolis -5:44:38 - LMT 1883 Nov 18 12:15:22 -6:00 US C%sT 1920 -6:00 Indianapolis C%sT 1942 @@ -910,7 +958,7 @@ Rule Marengo 1951 only - Sep lastSun 2:00 0 S Rule Marengo 1954 1960 - Apr lastSun 2:00 1:00 D Rule Marengo 1954 1960 - Sep lastSun 2:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Indiana/Marengo -5:45:23 - LMT 1883 Nov 18 12:14:37 -6:00 US C%sT 1951 -6:00 Marengo C%sT 1961 Apr 30 2:00 @@ -934,7 +982,7 @@ Rule Vincennes 1960 only - Oct lastSun 2:00 0 S Rule Vincennes 1961 only - Sep lastSun 2:00 0 S Rule Vincennes 1962 1963 - Oct lastSun 2:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Indiana/Vincennes -5:50:07 - LMT 1883 Nov 18 12:09:53 -6:00 US C%sT 1946 -6:00 Vincennes C%sT 1964 Apr 26 2:00 @@ -945,21 +993,21 @@ -5:00 US E%sT # # Perry County, Indiana, switched from eastern to central time in April 2006. +# From Alois Triendl (2019-07-09): +# The Indianapolis News, Friday 27 October 1967 states that Perry County +# returned to CST. It went again to EST on 27 April 1969, as documented by the +# Indianapolis star of Saturday 26 April. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER -Rule Perry 1946 only - Apr lastSun 2:00 1:00 D -Rule Perry 1946 only - Sep lastSun 2:00 0 S -Rule Perry 1953 1954 - Apr lastSun 2:00 1:00 D -Rule Perry 1953 1959 - Sep lastSun 2:00 0 S Rule Perry 1955 only - May 1 0:00 1:00 D +Rule Perry 1955 1960 - Sep lastSun 2:00 0 S Rule Perry 1956 1963 - Apr lastSun 2:00 1:00 D -Rule Perry 1960 only - Oct lastSun 2:00 0 S -Rule Perry 1961 only - Sep lastSun 2:00 0 S -Rule Perry 1962 1963 - Oct lastSun 2:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Rule Perry 1961 1963 - Oct lastSun 2:00 0 S +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Indiana/Tell_City -5:47:03 - LMT 1883 Nov 18 12:12:57 -6:00 US C%sT 1946 -6:00 Perry C%sT 1964 Apr 26 2:00 - -5:00 - EST 1969 + -5:00 - EST 1967 Oct 29 2:00 + -6:00 US C%sT 1969 Apr 27 2:00 -5:00 US E%sT 1971 -5:00 - EST 2006 Apr 2 2:00 -6:00 US C%sT @@ -971,7 +1019,7 @@ Rule Pike 1955 1960 - Sep lastSun 2:00 0 S Rule Pike 1956 1964 - Apr lastSun 2:00 1:00 D Rule Pike 1961 1964 - Oct lastSun 2:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Indiana/Petersburg -5:49:07 - LMT 1883 Nov 18 12:10:53 -6:00 US C%sT 1955 -6:00 Pike C%sT 1965 Apr 25 2:00 @@ -993,7 +1041,7 @@ Rule Starke 1955 1956 - Oct lastSun 2:00 0 S Rule Starke 1957 1958 - Sep lastSun 2:00 0 S Rule Starke 1959 1961 - Oct lastSun 2:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Indiana/Knox -5:46:30 - LMT 1883 Nov 18 12:13:30 -6:00 US C%sT 1947 -6:00 Starke C%sT 1962 Apr 29 2:00 @@ -1009,7 +1057,7 @@ Rule Pulaski 1946 1954 - Sep lastSun 2:00 0 S Rule Pulaski 1955 1956 - Oct lastSun 2:00 0 S Rule Pulaski 1957 1960 - Sep lastSun 2:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Indiana/Winamac -5:46:25 - LMT 1883 Nov 18 12:13:35 -6:00 US C%sT 1946 -6:00 Pulaski C%sT 1961 Apr 30 2:00 @@ -1020,7 +1068,7 @@ -5:00 US E%sT # # Switzerland County, Indiana, did not observe DST from 1973 through 2005. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Indiana/Vevay -5:40:16 - LMT 1883 Nov 18 12:19:44 -6:00 US C%sT 1954 Apr 25 2:00 -5:00 - EST 1969 @@ -1035,17 +1083,28 @@ # clear how this matched civil time in Louisville, so for now continue # to assume Louisville switched at noon new local time, like New York. # +# From Michael Deckers (2019-08-06): +# From the contemporary source given by Alois Treindl, +# the switch in Louisville on 1946-04-28 was on 00:01 +# From Paul Eggert (2019-08-26): +# That source was the Louisville Courier-Journal, 1946-04-27, p 4. +# Shanks gives 02:00 for all 20th-century transition times in Louisville. +# Evidently this is wrong for spring 1946. Although also likely wrong +# for other dates, we have no data. +# # Part of Kentucky left its clocks alone in 1974. # This also includes Clark, Floyd, and Harrison counties in Indiana. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER Rule Louisville 1921 only - May 1 2:00 1:00 D Rule Louisville 1921 only - Sep 1 2:00 0 S -Rule Louisville 1941 1961 - Apr lastSun 2:00 1:00 D +Rule Louisville 1941 only - Apr lastSun 2:00 1:00 D Rule Louisville 1941 only - Sep lastSun 2:00 0 S +Rule Louisville 1946 only - Apr lastSun 0:01 1:00 D Rule Louisville 1946 only - Jun 2 2:00 0 S +Rule Louisville 1950 1961 - Apr lastSun 2:00 1:00 D Rule Louisville 1950 1955 - Sep lastSun 2:00 0 S -Rule Louisville 1956 1960 - Oct lastSun 2:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Rule Louisville 1956 1961 - Oct lastSun 2:00 0 S +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Kentucky/Louisville -5:43:02 - LMT 1883 Nov 18 12:16:58 -6:00 US C%sT 1921 -6:00 Louisville C%sT 1942 @@ -1134,29 +1193,32 @@ # one hour in 1914." This change is not in Shanks. We have no more # info, so omit this for now. # -# From Paul Eggert (2017-07-26): -# Although Shanks says Detroit observed DST in 1967 from 06-14 00:01 -# until 10-29 00:01, I now see multiple reports that this is incorrect. -# For example, according to a 50-year anniversary report about the 1967 -# Detroit riots and a major-league doubleheader on 1967-07-23, "By the time -# the last fly ball of the doubleheader settled into the glove of leftfielder -# Lenny Green, it was after 7 p.m. Detroit did not observe daylight saving -# time, so light was already starting to fail. Twilight was made even deeper -# by billowing columns of smoke that ascended in an unbroken wall north of the -# ballpark." See: Dow B. Detroit '67: As violence unfolded, Tigers played two -# at home vs. Yankees. Detroit Free Press 2017-07-23. -# https://www.freep.com/story/sports/mlb/tigers/2017/07/23/detroit-tigers-1967-riot-new-york-yankees/499951001/ +# From Paul Eggert (2019-07-06): +# Due to a complicated set of legal maneuvers, in 1967 Michigan did +# not start daylight saving time when the rest of the US did. +# Instead, it began DST on Jun 14 at 00:01. This was big news: +# the Detroit Free Press reported it at the top of Page 1 on +# 1967-06-14, in an article "State Adjusting to Switch to Fast Time" +# by Gary Blonston, above an article about Thurgood Marshall's +# confirmation to the US Supreme Court. Although Shanks says Detroit +# observed DST until 1967-10-29 00:01, that time of day seems to be +# incorrect, as the Free Press later said DST ended in Michigan at the +# same time as the rest of the US. Also, although Shanks reports no DST in +# Detroit in 1968, it did observe DST that year; in the November 1968 +# election Michigan voters narrowly repealed DST, effective 1969. # # Most of Michigan observed DST from 1973 on, but was a bit late in 1975. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER Rule Detroit 1948 only - Apr lastSun 2:00 1:00 D Rule Detroit 1948 only - Sep lastSun 2:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Detroit -5:32:11 - LMT 1905 -6:00 - CST 1915 May 15 2:00 -5:00 - EST 1942 -5:00 US E%sT 1946 - -5:00 Detroit E%sT 1973 + -5:00 Detroit E%sT 1967 Jun 14 0:01 + -5:00 US E%sT 1969 + -5:00 - EST 1973 -5:00 US E%sT 1975 -5:00 - EST 1975 Apr 27 2:00 -5:00 US E%sT @@ -1168,7 +1230,7 @@ Rule Menominee 1946 only - Sep lastSun 2:00 0 S Rule Menominee 1966 only - Apr lastSun 2:00 1:00 D Rule Menominee 1966 only - Oct lastSun 2:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Menominee -5:50:27 - LMT 1885 Sep 18 12:00 -6:00 US C%sT 1946 -6:00 Menominee C%sT 1969 Apr 27 2:00 @@ -1205,6 +1267,12 @@ # # Other sources occasionally used include: # +# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94 +# <https://www.jstor.org/stable/1774359>. +# +# Pearce C. The Great Daylight Saving Time Controversy. +# Australian Ebook Publisher. 2017. ISBN 978-1-925516-96-8. +# # Edward W. Whitman, World Time Differences, # Whitman Publishing Co, 2 Niagara Av, Ealing, London (undated), # which I found in the UCLA library. @@ -1213,9 +1281,6 @@ # <http://cs.ucla.edu/~eggert/The-Waste-of-Daylight-19th.pdf> # [PDF] (1914-03) # -# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94 -# <https://www.jstor.org/stable/1774359>. -# # See the 'europe' file for Greenland. # Canada @@ -1402,7 +1467,7 @@ Rule StJohns 2007 2010 - Nov Sun>=1 0:01 0 S # # St John's has an apostrophe, but Posix file names can't have apostrophes. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/St_Johns -3:30:52 - LMT 1884 -3:30:52 StJohns N%sT 1918 -3:30:52 Canada N%sT 1919 @@ -1415,7 +1480,7 @@ # most of east Labrador # The name 'Happy Valley-Goose Bay' is too long; use 'Goose Bay'. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Goose_Bay -4:01:40 - LMT 1884 # Happy Valley-Goose Bay -3:30:52 - NST 1918 -3:30:52 Canada N%sT 1919 @@ -1489,7 +1554,7 @@ Rule Halifax 1956 1959 - Sep lastSun 2:00 0 S Rule Halifax 1962 1973 - Apr lastSun 2:00 1:00 D Rule Halifax 1962 1973 - Oct lastSun 2:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Halifax -4:14:24 - LMT 1902 Jun 15 -4:00 Halifax A%sT 1918 -4:00 Canada A%sT 1919 @@ -1527,7 +1592,7 @@ Rule Moncton 1957 1972 - Oct lastSun 2:00 0 S Rule Moncton 1993 2006 - Apr Sun>=1 0:01 1:00 D Rule Moncton 1993 2006 - Oct lastSun 0:01 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Moncton -4:19:08 - LMT 1883 Dec 9 -5:00 - EST 1902 Jun 15 -4:00 Canada A%sT 1933 @@ -1556,7 +1621,7 @@ # For lack of better info, guess this practice began around 1970, contra to # Shanks & Pottenger who have this region observing AST/ADT. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Blanc-Sablon -3:48:28 - LMT 1884 -4:00 Canada A%sT 1970 -4:00 - AST @@ -1724,19 +1789,10 @@ # was meant. Rule Toronto 1922 1926 - Sep Sun>=15 2:00 0 S Rule Toronto 1924 1927 - May Sun>=1 2:00 1:00 D -# The 1927-to-1939 rules can be expressed more simply as -# Rule Toronto 1927 1937 - Sep Sun>=25 2:00 0 S -# Rule Toronto 1928 1937 - Apr Sun>=25 2:00 1:00 D -# Rule Toronto 1938 1940 - Apr lastSun 2:00 1:00 D -# Rule Toronto 1938 1939 - Sep lastSun 2:00 0 S -# The rules below avoid use of Sun>=25 -# (which pre-2004 versions of zic cannot handle). -Rule Toronto 1927 1932 - Sep lastSun 2:00 0 S -Rule Toronto 1928 1931 - Apr lastSun 2:00 1:00 D -Rule Toronto 1932 only - May 1 2:00 1:00 D -Rule Toronto 1933 1940 - Apr lastSun 2:00 1:00 D -Rule Toronto 1933 only - Oct 1 2:00 0 S -Rule Toronto 1934 1939 - Sep lastSun 2:00 0 S +Rule Toronto 1927 1937 - Sep Sun>=25 2:00 0 S +Rule Toronto 1928 1937 - Apr Sun>=25 2:00 1:00 D +Rule Toronto 1938 1940 - Apr lastSun 2:00 1:00 D +Rule Toronto 1938 1939 - Sep lastSun 2:00 0 S Rule Toronto 1945 1946 - Sep lastSun 2:00 0 S Rule Toronto 1946 only - Apr lastSun 2:00 1:00 D Rule Toronto 1947 1949 - Apr lastSun 0:00 1:00 D @@ -1769,7 +1825,7 @@ # War,... [t]he cities agreed to implement DST during the summer # months for the remainder of the war years. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Toronto -5:17:32 - LMT 1895 -5:00 Canada E%sT 1919 -5:00 Toronto E%sT 1942 Feb 9 2:00s @@ -1844,7 +1900,7 @@ Rule Winn 1966 1986 - Apr lastSun 2:00s 1:00 D Rule Winn 1966 2005 - Oct lastSun 2:00s 0 S Rule Winn 1987 2005 - Apr Sun>=1 2:00s 1:00 D -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Winnipeg -6:28:36 - LMT 1887 Jul 16 -6:00 Winn C%sT 2006 -6:00 Canada C%sT @@ -1866,6 +1922,12 @@ # Willett (1914-03) notes that DST "has been in operation ... in the # City of Moose Jaw, Saskatchewan, for one year." +# From Paul Eggert (2019-07-25): +# Pearce's book says Regina observed DST in 1914-1917. No dates and times, +# unfortunately. It also says that in 1914 Saskatoon observed DST +# from 1 June to 6 July, and that DST was also tried out in Davidson, +# Melfort, and Prince Albert. + # From Paul Eggert (2006-03-22): # Shanks & Pottenger say that since 1970 this region has mostly been as Regina. # Some western towns (e.g. Swift Current) switched from MST/MDT to CST in 1972. @@ -1928,7 +1990,7 @@ Rule Swift 1959 1961 - Apr lastSun 2:00 1:00 D Rule Swift 1959 only - Oct lastSun 2:00 0 S Rule Swift 1960 1961 - Sep lastSun 2:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Regina -6:58:36 - LMT 1905 Sep -7:00 Regina M%sT 1960 Apr lastSun 2:00 -6:00 - CST @@ -1941,6 +2003,19 @@ # Alberta +# From Alois Triendl (2019-07-19): +# There was no DST in Alberta in 1967... Calgary Herald, 29 April 1967. +# 1969, no DST, from Edmonton Journal 18 April 1969 +# +# From Paul Eggert (2019-07-25): +# Pearce's book says that Alberta's 1948 Daylight Saving Act required +# Mountain Standard Time without DST, and that "anyone who broke that law +# could be fined up to $25 and costs". There seems to be no record of +# anybody paying the fine. The law was not changed until an August 1971 +# plebiscite reinstituted DST in 1972. This story is also mentioned in: +# Boyer JP. Forcing Choice: The Risky Reward of Referendums. Dundum. 2017. +# ISBN 978-1459739123. + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Edm 1918 1919 - Apr Sun>=8 2:00 1:00 D Rule Edm 1918 only - Oct 27 2:00 0 S @@ -1953,13 +2028,9 @@ Rule Edm 1945 only - Sep lastSun 2:00 0 S Rule Edm 1947 only - Apr lastSun 2:00 1:00 D Rule Edm 1947 only - Sep lastSun 2:00 0 S -Rule Edm 1967 only - Apr lastSun 2:00 1:00 D -Rule Edm 1967 only - Oct lastSun 2:00 0 S -Rule Edm 1969 only - Apr lastSun 2:00 1:00 D -Rule Edm 1969 only - Oct lastSun 2:00 0 S Rule Edm 1972 1986 - Apr lastSun 2:00 1:00 D Rule Edm 1972 2006 - Oct lastSun 2:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Edmonton -7:33:52 - LMT 1906 Sep -7:00 Edm M%sT 1987 -7:00 Canada M%sT @@ -2039,8 +2110,20 @@ # been on MST (-0700) like Dawson Creek since it advanced its clocks on # 2015-03-08. # -# From Paul Eggert (2015-09-23): +# From Paul Eggert (2019-07-25): # Shanks says Fort Nelson did not observe DST in 1946, unlike Vancouver. +# Alois Triendl confirmed this on 07-22, citing the 1946-04-27 Vancouver Daily +# Province. He also cited the 1946-09-28 Victoria Daily Times, which said +# that Vancouver, Victoria, etc. "change at midnight Saturday"; for now, +# guess they meant 02:00 Sunday since 02:00 was common practice in Vancouver. +# +# Early Vancouver, Volume Four, by Major J.S. Matthews, V.D., 2011 edition +# says that a 1922 plebiscite adopted DST, but a 1923 plebiscite rejected it. +# http://former.vancouver.ca/ctyclerk/archives/digitized/EarlyVan/SearchEarlyVan/Vol4pdf/MatthewsEarlyVancouverVol4_DaylightSavings.pdf +# A catalog entry for a newspaper clipping seems to indicate that Vancouver +# observed DST in 1941 from 07-07 through 09-27; see +# https://searcharchives.vancouver.ca/daylight-saving-1918-starts-again-july-7-1941-start-d-s-sept-27-end-of-d-s-1941 +# We have no further details, so omit them for now. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Vanc 1918 only - Apr 14 2:00 1:00 D @@ -2049,10 +2132,10 @@ Rule Vanc 1945 only - Aug 14 23:00u 1:00 P # Peace Rule Vanc 1945 only - Sep 30 2:00 0 S Rule Vanc 1946 1986 - Apr lastSun 2:00 1:00 D -Rule Vanc 1946 only - Oct 13 2:00 0 S +Rule Vanc 1946 only - Sep 29 2:00 0 S Rule Vanc 1947 1961 - Sep lastSun 2:00 0 S Rule Vanc 1962 2006 - Oct lastSun 2:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Vancouver -8:12:28 - LMT 1884 -8:00 Vanc P%sT 1987 -8:00 Canada P%sT @@ -2123,7 +2206,7 @@ # varying the manner of reckoning standard time. # # * Yukon Territory Commissioner's Order 1966-20 Interpretation Ordinance -# http://? - no online source found +# [no online source found] # # * Standard Time and Time Zones in Canada; Thomson, Malcolm M.; JRASC, # Vol. 64, pp.129-162; June 1970; SAO/NASA Astrophysics Data System (ADS) @@ -2156,7 +2239,7 @@ # to say eight hours behind Greenwich Time. # # * O.I.C. 1980/02 INTERPRETATION ACT -# http://? - no online source found +# [no online source found] # # * Yukon Daylight Saving Time, YOIC 1987/56 # https://www.canlii.org/en/yk/laws/regu/yoic-1987-56/latest/yoic-1987-56.html @@ -2372,7 +2455,7 @@ Rule NT_YK 1980 1986 - Apr lastSun 2:00 1:00 D Rule NT_YK 1980 2006 - Oct lastSun 2:00 0 S Rule NT_YK 1987 2006 - Apr Sun>=1 2:00 1:00 D -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] # aka Panniqtuuq Zone America/Pangnirtung 0 - -00 1921 # trading post est. -4:00 NT_YK A%sT 1995 Apr Sun>=1 2:00 @@ -2519,7 +2602,7 @@ # From Paul Eggert (2001-03-03): # -# http://www.latimes.com/news/nation/20010303/t000018766.html +# https://www.latimes.com/archives/la-xpm-2001-mar-03-mn-32561-story.html # James F. Smith writes in today's LA Times # * Sonora will continue to observe standard time. # * Last week Mexico City's mayor Andrés Manuel López Obrador decreed that @@ -2646,7 +2729,7 @@ Rule Mexico 2001 only - Sep lastSun 2:00 0 S Rule Mexico 2002 max - Apr Sun>=1 2:00 1:00 D Rule Mexico 2002 max - Oct lastSun 2:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] # Quintana Roo; represented by Cancún Zone America/Cancun -5:47:04 - LMT 1922 Jan 1 0:12:56 -6:00 - CST 1981 Dec 23 @@ -2839,7 +2922,7 @@ # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Bahamas 1964 1975 - Oct lastSun 2:00 0 S Rule Bahamas 1964 1975 - Apr lastSun 2:00 1:00 D -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Nassau -5:09:30 - LMT 1912 Mar 2 -5:00 Bahamas E%sT 1976 -5:00 US E%sT @@ -2854,7 +2937,7 @@ Rule Barb 1978 1980 - Apr Sun>=15 2:00 1:00 D Rule Barb 1979 only - Sep 30 2:00 0 S Rule Barb 1980 only - Sep 25 2:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Barbados -3:58:29 - LMT 1924 # Bridgetown -3:58:29 - BMT 1932 # Bridgetown Mean Time -4:00 Barb A%sT @@ -2868,7 +2951,7 @@ Rule Belize 1974 only - Feb 9 0:00 0 CST Rule Belize 1982 only - Dec 18 0:00 1:00 CDT Rule Belize 1983 only - Feb 12 0:00 0 CST -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Belize -5:52:48 - LMT 1912 Apr -6:00 Belize %s @@ -2885,7 +2968,7 @@ # Friday, the same thing will happen in Bermuda. # http://www.theroyalgazette.com/apps/pbcs.dll/article?AID=/20060529/NEWS/105290135 -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Atlantic/Bermuda -4:19:18 - LMT 1930 Jan 1 2:00 # Hamilton -4:00 - AST 1974 Apr 28 2:00 -4:00 Canada A%sT 1976 @@ -2907,7 +2990,7 @@ Rule CR 1991 only - Jul 1 0:00 0 S Rule CR 1992 only - Mar 15 0:00 0 S # There are too many San Josés elsewhere, so we'll use 'Costa Rica'. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Costa_Rica -5:36:13 - LMT 1890 # San José -5:36:13 - SJMT 1921 Jan 15 # San José Mean Time -6:00 CR C%sT @@ -3113,7 +3196,7 @@ Rule Cuba 2012 max - Nov Sun>=1 0:00s 0 S Rule Cuba 2013 max - Mar Sun>=8 0:00s 1:00 D -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Havana -5:29:28 - LMT 1890 -5:29:36 - HMT 1925 Jul 19 12:00 # Havana MT -5:00 Cuba C%sT @@ -3148,7 +3231,7 @@ Rule DR 1970 only - Feb 21 0:00 0 EST Rule DR 1971 only - Jan 20 0:00 0 EST Rule DR 1972 1974 - Jan 21 0:00 0 EST -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Santo_Domingo -4:39:36 - LMT 1890 -4:40 - SDMT 1933 Apr 1 12:00 # S. Dom. MT -5:00 DR %s 1974 Oct 27 @@ -3163,7 +3246,7 @@ Rule Salv 1987 1988 - Sep lastSun 0:00 0 S # There are too many San Salvadors elsewhere, so use America/El_Salvador # instead of America/San_Salvador. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/El_Salvador -5:56:48 - LMT 1921 # San Salvador -6:00 Salv C%sT @@ -3196,7 +3279,7 @@ Rule Guat 1991 only - Sep 7 0:00 0 S Rule Guat 2006 only - Apr 30 0:00 1:00 D Rule Guat 2006 only - Oct 1 0:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Guatemala -6:02:04 - LMT 1918 Oct 5 -6:00 Guat C%sT @@ -3282,7 +3365,7 @@ Rule Haiti 2012 2015 - Nov Sun>=1 2:00 0 S Rule Haiti 2017 max - Mar Sun>=8 2:00 1:00 D Rule Haiti 2017 max - Nov Sun>=1 2:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Port-au-Prince -4:49:20 - LMT 1890 -4:49 - PPMT 1917 Jan 24 12:00 # P-a-P MT -5:00 Haiti E%sT @@ -3321,7 +3404,7 @@ Rule Hond 1987 1988 - Sep lastSun 0:00 0 S Rule Hond 2006 only - May Sun>=1 0:00 1:00 D Rule Hond 2006 only - Aug Mon>=1 0:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Tegucigalpa -5:48:52 - LMT 1921 Apr -6:00 Hond C%sT # @@ -3342,7 +3425,7 @@ # Neita L. The politician in all of us. Jamaica Observer 2014-09-20 # http://www.jamaicaobserver.com/columns/The-politician-in-all-of-us_17573647 # -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Jamaica -5:07:10 - LMT 1890 # Kingston -5:07:10 - KMT 1912 Feb # Kingston Mean Time -5:00 - EST 1974 @@ -3350,7 +3433,7 @@ -5:00 - EST # Martinique -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Martinique -4:04:20 - LMT 1890 # Fort-de-France -4:04:20 - FFMT 1911 May # Fort-de-France MT -4:00 - AST 1980 Apr 6 @@ -3414,7 +3497,7 @@ Rule Nic 2005 only - Oct Sun>=1 0:00 0 S Rule Nic 2006 only - Apr 30 2:00 1:00 D Rule Nic 2006 only - Oct Sun>=1 1:00 0 S -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Managua -5:45:08 - LMT 1890 -5:45:12 - MMT 1934 Jun 23 # Managua Mean Time? -6:00 - CST 1973 May @@ -3426,7 +3509,7 @@ -6:00 Nic C%sT # Panama -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Panama -5:18:08 - LMT 1890 -5:19:36 - CMT 1908 Apr 22 # Colón Mean Time -5:00 - EST @@ -3434,7 +3517,7 @@ # Puerto Rico # There are too many San Juans elsewhere, so we'll use 'Puerto_Rico'. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Puerto_Rico -4:24:25 - LMT 1899 Mar 28 12:00 # San Juan -4:00 - AST 1942 May 3 -4:00 US A%sT 1946 @@ -3446,7 +3529,7 @@ # St Pierre and Miquelon # There are too many St Pierres elsewhere, so we'll use 'Miquelon'. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Miquelon -3:44:40 - LMT 1911 May 15 # St Pierre -4:00 - AST 1980 May -3:00 - -03 1987 @@ -3492,7 +3575,7 @@ # by March 2018 for TCI. Magnetic Media. 2017-08-25. # http://magneticmediatv.com/2017/08/time-change-back-by-march-2018-for-tci/ # -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Grand_Turk -4:44:32 - LMT 1890 -5:07:10 - KMT 1912 Feb # Kingston Mean Time -5:00 - EST 1979
--- a/make/data/tzdata/pacificnew Mon Sep 09 17:27:04 2019 +0100 +++ b/make/data/tzdata/pacificnew Wed Oct 23 15:35:04 2019 +0100 @@ -44,7 +44,7 @@ ## Rule Twilite XXXX max uspres Nov Sun>=7 2:00 0 S ## Rule Twilite XXXX max nonpres Oct lastSun 2:00 0 S -# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] +# Zone NAME STDOFF RULES/SAVE FORMAT [UNTIL] ## Zone America/Los_Angeles-PET -8:00 US P%sT XXXX ## -8:00 Twilite P%sT
--- a/make/data/tzdata/southamerica Mon Sep 09 17:27:04 2019 +0100 +++ b/make/data/tzdata/southamerica Wed Oct 23 15:35:04 2019 +0100 @@ -419,7 +419,7 @@ # plus is that this silences a zic complaint that there's no POSIX TZ # setting for timestamps past 2038. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] # # Buenos Aires (BA), Capital Federal (CF), Zone America/Argentina/Buenos_Aires -3:53:48 - LMT 1894 Oct 31 @@ -600,7 +600,7 @@ Link America/Curacao America/Aruba # Bolivia -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/La_Paz -4:32:36 - LMT 1890 -4:32:36 - CMT 1931 Oct 15 # Calamarca MT -4:32:36 1:00 BST 1932 Mar 21 # Bolivia ST @@ -943,14 +943,13 @@ # removed Tocantins. Rule Brazil 2013 2014 - Feb Sun>=15 0:00 0 - Rule Brazil 2015 only - Feb Sun>=22 0:00 0 - -Rule Brazil 2016 2022 - Feb Sun>=15 0:00 0 - +Rule Brazil 2016 2019 - Feb Sun>=15 0:00 0 - # From Steffen Thorsen (2017-12-18): # According to many media sources, next year's DST start in Brazil will move to -# the first Sunday of November, and it will stay like that for the years after. +# the first Sunday of November # ... https://www.timeanddate.com/news/time/brazil-delays-dst-2018.html # From Steffen Thorsen (2017-12-20): # http://www.planalto.gov.br/ccivil_03/_ato2015-2018/2017/decreto/D9242.htm -# # From Fábio Gomes (2018-10-04): # The Brazilian president just announced a new change on this year DST. # It was scheduled to start on November 4th and it was changed to November 18th. @@ -958,22 +957,21 @@ # The Brazilian government just announced that the change in DST was # canceled.... Maybe the president Michel Temer also woke up one hour # earlier today. :) -Rule Brazil 2018 max - Nov Sun>=1 0:00 1:00 - -Rule Brazil 2023 only - Feb Sun>=22 0:00 0 - -Rule Brazil 2024 2025 - Feb Sun>=15 0:00 0 - -Rule Brazil 2026 only - Feb Sun>=22 0:00 0 - -Rule Brazil 2027 2033 - Feb Sun>=15 0:00 0 - -Rule Brazil 2034 only - Feb Sun>=22 0:00 0 - -Rule Brazil 2035 2036 - Feb Sun>=15 0:00 0 - -Rule Brazil 2037 only - Feb Sun>=22 0:00 0 - -# From Arthur David Olson (2008-09-29): -# The next is wrong in some years but is better than nothing. -Rule Brazil 2038 max - Feb Sun>=15 0:00 0 - +Rule Brazil 2018 only - Nov Sun>=1 0:00 1:00 - +# The last ruleset listed above says that the following states observed DST: +# DF, ES, GO, MG, MS, MT, PR, RJ, RS, SC, SP. +# +# From Steffen Thorsen (2019-04-05): +# According to multiple sources the Brazilian president wants to get rid of DST. +# https://gmconline.com.br/noticias/politica/bolsonaro-horario-de-verao-deve-acabar-este-ano +# https://g1.globo.com/economia/noticia/2019/04/05/governo-anuncia-fim-do-horario-de-verao.ghtml +# From Marcus Diniz (2019-04-25): +# Brazil no longer has DST changes - decree signed today +# https://g1.globo.com/politica/noticia/2019/04/25/bolsonaro-assina-decreto-que-acaba-com-o-horario-de-verao.ghtml +# From Daniel Soares de Oliveira (2019-04-26): +# http://www.planalto.gov.br/ccivil_03/_Ato2019-2022/2019/Decreto/D9772.htm -# The latest ruleset listed above says that the following states observe DST: -# DF, ES, GO, MG, MS, MT, PR, RJ, RS, SC, SP. - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] # # Fernando de Noronha (administratively part of PE) Zone America/Noronha -2:09:40 - LMT 1914 @@ -1255,14 +1253,8 @@ # From Juan Correa (2016-12-04): # Magallanes region ... will keep DST (UTC -3) all year round.... # http://www.soychile.cl/Santiago/Sociedad/2016/12/04/433428/Bachelet-firmo-el-decreto-para-establecer-un-horario-unico-para-la-Region-de-Magallanes.aspx -# # From Deborah Goldsmith (2017-01-19): # http://www.diariooficial.interior.gob.cl/publicaciones/2017/01/17/41660/01/1169626.pdf -# From Paul Eggert (2017-01-19): -# The above says the Magallanes change expires 2019-05-11 at 24:00, -# so in theory, they will revert to -04/-03 after that, which means -# they will switch from -03 to -04 one hour after Santiago does that day. -# For now, assume that they will not revert. # From Juan Correa (2018-08-13): # As of moments ago, the Ministry of Energy in Chile has announced the new @@ -1281,6 +1273,13 @@ # https://twitter.com/MinEnergia/status/1029009354001973248 # "We will keep the new time policy unchanged for at least the next 4 years." # So we extend the new rules on Saturdays at 24:00 mainland time indefinitely. +# From Juan Correa (2019-02-04): +# http://www.diariooficial.interior.gob.cl/publicaciones/2018/11/23/42212/01/1498738.pdf +# From Paul Eggert (2019-09-01): +# The above says the Magallanes exception expires 2022-04-02 at 24:00, +# so in theory, they will revert to -04/-03 after that. +# For now, assume that they will not revert, +# since they have extended the expiration date once already. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Chile 1927 1931 - Sep 1 0:00 1:00 - @@ -1321,7 +1320,7 @@ Rule Chile 2019 max - Sep Sun>=2 4:00u 1:00 - # IATA SSIM anomalies: (1992-02) says 1992-03-14; # (1996-09) says 1998-03-08. Ignore these. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Santiago -4:42:46 - LMT 1890 -4:42:46 - SMT 1910 Jan 10 # Santiago Mean Time -5:00 - -05 1916 Jul 1 @@ -1370,7 +1369,7 @@ # Palmer has followed Chile. Prior to that, before the Falklands War, # Palmer used to be supplied from Argentina. # -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Antarctica/Palmer 0 - -00 1965 -4:00 Arg -04/-03 1969 Oct 5 -3:00 Arg -03/-02 1982 May @@ -1385,7 +1384,7 @@ # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule CO 1992 only - May 3 0:00 1:00 - Rule CO 1993 only - Apr 4 0:00 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Bogota -4:56:16 - LMT 1884 Mar 13 -4:56:16 - BMT 1914 Nov 23 # Bogotá Mean Time -5:00 CO -05/-04 @@ -1410,7 +1409,7 @@ # Netherlands as Kingdom Islands. This won't affect their time zones # though, as far as we know. # -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Curacao -4:35:47 - LMT 1912 Feb 12 # Willemstad -4:30 - -0430 1965 -4:00 - AST @@ -1446,7 +1445,7 @@ Rule Ecuador 1992 only - Nov 28 0:00 1:00 - Rule Ecuador 1993 only - Feb 5 0:00 0 - # -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Guayaquil -5:19:20 - LMT 1890 -5:14:00 - QMT 1931 # Quito Mean Time -5:00 Ecuador -05/-04 @@ -1549,7 +1548,7 @@ Rule Falk 1986 2000 - Apr Sun>=16 0:00 0 - Rule Falk 2001 2010 - Apr Sun>=15 2:00 0 - Rule Falk 2001 2010 - Sep Sun>=1 2:00 1:00 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Atlantic/Stanley -3:51:24 - LMT 1890 -3:51:24 - SMT 1912 Mar 12 # Stanley Mean Time -4:00 Falk -04/-03 1983 May @@ -1558,13 +1557,13 @@ -3:00 - -03 # French Guiana -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Cayenne -3:29:20 - LMT 1911 Jul -4:00 - -04 1967 Oct -3:00 - -03 # Guyana -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Guyana -3:52:40 - LMT 1915 Mar # Georgetown -3:45 - -0345 1975 Jul 31 -3:00 - -03 1991 @@ -1658,7 +1657,7 @@ # http://www.presidencia.gov.py/archivos/documentos/DECRETO1264_ey9r8zai.pdf Rule Para 2013 max - Mar Sun>=22 0:00 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Asuncion -3:50:40 - LMT 1890 -3:50:40 - AMT 1931 Oct 10 # Asunción Mean Time -4:00 - -04 1972 Oct @@ -1687,13 +1686,13 @@ # IATA is ambiguous for 1993/1995; go with Shanks & Pottenger. Rule Peru 1994 only - Jan 1 0:00 1:00 - Rule Peru 1994 only - Apr 1 0:00 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Lima -5:08:12 - LMT 1890 -5:08:36 - LMT 1908 Jul 28 # Lima Mean Time? -5:00 Peru -05/-04 # South Georgia -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Atlantic/South_Georgia -2:26:08 - LMT 1890 # Grytviken -2:00 - -02 @@ -1701,7 +1700,7 @@ # uninhabited; scientific personnel have wintered # Suriname -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Paramaribo -3:40:40 - LMT 1911 -3:40:52 - PMT 1935 # Paramaribo Mean Time -3:40:36 - PMT 1945 Oct # The capital moved? @@ -1709,7 +1708,7 @@ -3:00 - -03 # Trinidad and Tobago -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Port_of_Spain -4:06:04 - LMT 1912 Mar 2 -4:00 - AST @@ -1980,7 +1979,7 @@ # ... published in the official Gazette [2016-04-18], here: # http://historico.tsj.gob.ve/gaceta_ext/abril/1842016/E-1842016-4551.pdf -# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Caracas -4:27:44 - LMT 1890 -4:27:40 - CMT 1912 Feb 12 # Caracas Mean Time? -4:30 - -0430 1965 Jan 1 0:00
--- a/make/data/tzdata/systemv Mon Sep 09 17:27:04 2019 +0100 +++ b/make/data/tzdata/systemv Wed Oct 23 15:35:04 2019 +0100 @@ -46,7 +46,7 @@ Rule SystemV 1976 max - Apr lastSun 2:00 1:00 D Rule SystemV 1976 max - Oct lastSun 2:00 0 S -# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] +# Zone NAME STDOFF RULES/SAVE FORMAT [UNTIL] ## Zone SystemV/AST4ADT -4:00 SystemV A%sT ## Zone SystemV/EST5EDT -5:00 SystemV E%sT ## Zone SystemV/CST6CDT -6:00 SystemV C%sT
--- a/make/data/tzdata/zone.tab Mon Sep 09 17:27:04 2019 +0100 +++ b/make/data/tzdata/zone.tab Wed Oct 23 15:35:04 2019 +0100 @@ -355,7 +355,10 @@ RS +4450+02030 Europe/Belgrade RU +5443+02030 Europe/Kaliningrad MSK-01 - Kaliningrad RU +554521+0373704 Europe/Moscow MSK+00 - Moscow area -RU +4457+03406 Europe/Simferopol MSK+00 - Crimea +# The obsolescent zone.tab format cannot represent Europe/Simferopol well. +# Put it in RU section and list as UA. See "territorial claims" above. +# Programs should use zone1970.tab instead; see above. +UA +4457+03406 Europe/Simferopol MSK+00 - Crimea RU +5836+04939 Europe/Kirov MSK+00 - Kirov RU +4621+04803 Europe/Astrakhan MSK+01 - Astrakhan RU +4844+04425 Europe/Volgograd MSK+01 - Volgograd
--- a/make/lib/Awt2dLibraries.gmk Mon Sep 09 17:27:04 2019 +0100 +++ b/make/lib/Awt2dLibraries.gmk Wed Oct 23 15:35:04 2019 +0100 @@ -1198,6 +1198,7 @@ endif LIBSPLASHSCREEN_CFLAGS := -DSPLASHSCREEN -DPNG_NO_MMX_CODE \ + -DPNG_ARM_NEON_OPT=0 -DPNG_ARM_NEON_IMPLEMENTATION=0 \ $(foreach dir, $(LIBSPLASHSCREEN_DIRS), -I$(dir)) ifeq ($(OPENJDK_TARGET_OS), macosx)
--- a/make/lib/NetworkingLibraries.gmk Mon Sep 09 17:27:04 2019 +0100 +++ b/make/lib/NetworkingLibraries.gmk Wed Oct 23 15:35:04 2019 +0100 @@ -79,7 +79,7 @@ LDFLAGS_SUFFIX_linux := $(LIBDL) -ljvm -lpthread -ljava, \ LDFLAGS_SUFFIX_aix := $(LIBDL) -ljvm -ljava,\ LDFLAGS_SUFFIX_windows := ws2_32.lib jvm.lib secur32.lib iphlpapi.lib \ - delayimp.lib urlmon.lib $(WIN_JAVA_LIB) advapi32.lib \ + delayimp.lib $(WIN_JAVA_LIB) advapi32.lib \ -DELAYLOAD:secur32.dll -DELAYLOAD:iphlpapi.dll, \ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \ RC_FLAGS := $(RC_FLAGS) \
--- a/src/share/classes/com/sun/crypto/provider/CipherBlockChaining.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/com/sun/crypto/provider/CipherBlockChaining.java Wed Oct 23 15:35:04 2019 +0100 @@ -29,8 +29,6 @@ import java.security.ProviderException; import java.util.Objects; -import sun.security.util.ArrayUtil; - /** * This class represents ciphers in cipher block chaining (CBC) mode. * @@ -144,9 +142,9 @@ if (plainLen <= 0) { return plainLen; } - ArrayUtil.blockSizeCheck(plainLen, blockSize); - ArrayUtil.nullAndBoundsCheck(plain, plainOffset, plainLen); - ArrayUtil.nullAndBoundsCheck(cipher, cipherOffset, plainLen); + RangeUtil.blockSizeCheck(plainLen, blockSize); + RangeUtil.nullAndBoundsCheck(plain, plainOffset, plainLen); + RangeUtil.nullAndBoundsCheck(cipher, cipherOffset, plainLen); return implEncrypt(plain, plainOffset, plainLen, cipher, cipherOffset); } @@ -194,9 +192,9 @@ if (cipherLen <= 0) { return cipherLen; } - ArrayUtil.blockSizeCheck(cipherLen, blockSize); - ArrayUtil.nullAndBoundsCheck(cipher, cipherOffset, cipherLen); - ArrayUtil.nullAndBoundsCheck(plain, plainOffset, cipherLen); + RangeUtil.blockSizeCheck(cipherLen, blockSize); + RangeUtil.nullAndBoundsCheck(cipher, cipherOffset, cipherLen); + RangeUtil.nullAndBoundsCheck(plain, plainOffset, cipherLen); return implDecrypt(cipher, cipherOffset, cipherLen, plain, plainOffset); }
--- a/src/share/classes/com/sun/crypto/provider/CipherFeedback.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/com/sun/crypto/provider/CipherFeedback.java Wed Oct 23 15:35:04 2019 +0100 @@ -27,7 +27,6 @@ import java.security.InvalidKeyException; import java.security.ProviderException; -import sun.security.util.ArrayUtil; /** * This class represents ciphers in cipher-feedback (CFB) mode. @@ -150,9 +149,9 @@ */ int encrypt(byte[] plain, int plainOffset, int plainLen, byte[] cipher, int cipherOffset) { - ArrayUtil.blockSizeCheck(plainLen, numBytes); - ArrayUtil.nullAndBoundsCheck(plain, plainOffset, plainLen); - ArrayUtil.nullAndBoundsCheck(cipher, cipherOffset, plainLen); + RangeUtil.blockSizeCheck(plainLen, numBytes); + RangeUtil.nullAndBoundsCheck(plain, plainOffset, plainLen); + RangeUtil.nullAndBoundsCheck(cipher, cipherOffset, plainLen); int nShift = blockSize - numBytes; int loopCount = plainLen / numBytes; @@ -227,9 +226,9 @@ int decrypt(byte[] cipher, int cipherOffset, int cipherLen, byte[] plain, int plainOffset) { - ArrayUtil.blockSizeCheck(cipherLen, numBytes); - ArrayUtil.nullAndBoundsCheck(cipher, cipherOffset, cipherLen); - ArrayUtil.nullAndBoundsCheck(plain, plainOffset, cipherLen); + RangeUtil.blockSizeCheck(cipherLen, numBytes); + RangeUtil.nullAndBoundsCheck(cipher, cipherOffset, cipherLen); + RangeUtil.nullAndBoundsCheck(plain, plainOffset, cipherLen); int nShift = blockSize - numBytes; int loopCount = cipherLen / numBytes;
--- a/src/share/classes/com/sun/crypto/provider/CounterMode.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/com/sun/crypto/provider/CounterMode.java Wed Oct 23 15:35:04 2019 +0100 @@ -27,8 +27,6 @@ import java.security.InvalidKeyException; -import sun.security.util.ArrayUtil; - /** * This class represents ciphers in counter (CTR) mode. * @@ -175,8 +173,8 @@ return 0; } - ArrayUtil.nullAndBoundsCheck(in, inOff, len); - ArrayUtil.nullAndBoundsCheck(out, outOff, len); + RangeUtil.nullAndBoundsCheck(in, inOff, len); + RangeUtil.nullAndBoundsCheck(out, outOff, len); int result = len; while (len-- > 0) {
--- a/src/share/classes/com/sun/crypto/provider/ElectronicCodeBook.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/com/sun/crypto/provider/ElectronicCodeBook.java Wed Oct 23 15:35:04 2019 +0100 @@ -27,7 +27,6 @@ import java.security.InvalidKeyException; import java.security.ProviderException; -import sun.security.util.ArrayUtil; /** * This class represents ciphers in electronic codebook (ECB) mode. @@ -113,9 +112,9 @@ * @return the length of the encrypted data */ int encrypt(byte[] in, int inOff, int len, byte[] out, int outOff) { - ArrayUtil.blockSizeCheck(len, blockSize); - ArrayUtil.nullAndBoundsCheck(in, inOff, len); - ArrayUtil.nullAndBoundsCheck(out, outOff, len); + RangeUtil.blockSizeCheck(len, blockSize); + RangeUtil.nullAndBoundsCheck(in, inOff, len); + RangeUtil.nullAndBoundsCheck(out, outOff, len); for (int i = len; i >= blockSize; i -= blockSize) { embeddedCipher.encryptBlock(in, inOff, out, outOff); @@ -143,9 +142,9 @@ * @return the length of the decrypted data */ int decrypt(byte[] in, int inOff, int len, byte[] out, int outOff) { - ArrayUtil.blockSizeCheck(len, blockSize); - ArrayUtil.nullAndBoundsCheck(in, inOff, len); - ArrayUtil.nullAndBoundsCheck(out, outOff, len); + RangeUtil.blockSizeCheck(len, blockSize); + RangeUtil.nullAndBoundsCheck(in, inOff, len); + RangeUtil.nullAndBoundsCheck(out, outOff, len); for (int i = len; i >= blockSize; i -= blockSize) { embeddedCipher.decryptBlock(in, inOff, out, outOff);
--- a/src/share/classes/com/sun/crypto/provider/GaloisCounterMode.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/com/sun/crypto/provider/GaloisCounterMode.java Wed Oct 23 15:35:04 2019 +0100 @@ -30,7 +30,6 @@ import java.security.*; import javax.crypto.*; import static com.sun.crypto.provider.AESConstants.AES_BLOCK_SIZE; -import sun.security.util.ArrayUtil; /** @@ -424,12 +423,12 @@ int encrypt(byte[] in, int inOfs, int len, byte[] out, int outOfs) { checkDataLength(processed, len); - ArrayUtil.blockSizeCheck(len, blockSize); + RangeUtil.blockSizeCheck(len, blockSize); processAAD(); if (len > 0) { - ArrayUtil.nullAndBoundsCheck(in, inOfs, len); - ArrayUtil.nullAndBoundsCheck(out, outOfs, len); + RangeUtil.nullAndBoundsCheck(in, inOfs, len); + RangeUtil.nullAndBoundsCheck(out, outOfs, len); gctrPAndC.update(in, inOfs, len, out, outOfs); processed += len; @@ -456,7 +455,7 @@ ("Can't fit both data and tag into one buffer"); } try { - ArrayUtil.nullAndBoundsCheck(out, outOfs, + RangeUtil.nullAndBoundsCheck(out, outOfs, (len + tagLenBytes)); } catch (ArrayIndexOutOfBoundsException aiobe) { throw new ShortBufferException("Output buffer too small"); @@ -466,7 +465,7 @@ processAAD(); if (len > 0) { - ArrayUtil.nullAndBoundsCheck(in, inOfs, len); + RangeUtil.nullAndBoundsCheck(in, inOfs, len); doLastBlock(in, inOfs, len, out, outOfs, true); } @@ -503,14 +502,14 @@ int decrypt(byte[] in, int inOfs, int len, byte[] out, int outOfs) { checkDataLength(ibuffer.size(), len); - ArrayUtil.blockSizeCheck(len, blockSize); + RangeUtil.blockSizeCheck(len, blockSize); processAAD(); if (len > 0) { // store internally until decryptFinal is called because // spec mentioned that only return recovered data after tag // is successfully verified - ArrayUtil.nullAndBoundsCheck(in, inOfs, len); + RangeUtil.nullAndBoundsCheck(in, inOfs, len); ibuffer.write(in, inOfs, len); } return 0; @@ -545,7 +544,7 @@ checkDataLength(ibuffer.size(), (len - tagLenBytes)); try { - ArrayUtil.nullAndBoundsCheck(out, outOfs, + RangeUtil.nullAndBoundsCheck(out, outOfs, (ibuffer.size() + len) - tagLenBytes); } catch (ArrayIndexOutOfBoundsException aiobe) { throw new ShortBufferException("Output buffer too small"); @@ -553,7 +552,7 @@ processAAD(); - ArrayUtil.nullAndBoundsCheck(in, inOfs, len); + RangeUtil.nullAndBoundsCheck(in, inOfs, len); // get the trailing tag bytes from 'in' byte[] tag = new byte[tagLenBytes];
--- a/src/share/classes/com/sun/crypto/provider/OutputFeedback.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/com/sun/crypto/provider/OutputFeedback.java Wed Oct 23 15:35:04 2019 +0100 @@ -27,7 +27,6 @@ import java.security.InvalidKeyException; import java.security.ProviderException; -import sun.security.util.ArrayUtil; /** * This class represents ciphers in output-feedback (OFB) mode. @@ -149,9 +148,9 @@ */ int encrypt(byte[] plain, int plainOffset, int plainLen, byte[] cipher, int cipherOffset) { - ArrayUtil.blockSizeCheck(plainLen, numBytes); - ArrayUtil.nullAndBoundsCheck(plain, plainOffset, plainLen); - ArrayUtil.nullAndBoundsCheck(cipher, cipherOffset, plainLen); + RangeUtil.blockSizeCheck(plainLen, numBytes); + RangeUtil.nullAndBoundsCheck(plain, plainOffset, plainLen); + RangeUtil.nullAndBoundsCheck(cipher, cipherOffset, plainLen); int nShift = blockSize - numBytes; int loopCount = plainLen / numBytes; @@ -190,8 +189,8 @@ */ int encryptFinal(byte[] plain, int plainOffset, int plainLen, byte[] cipher, int cipherOffset) { - ArrayUtil.nullAndBoundsCheck(plain, plainOffset, plainLen); - ArrayUtil.nullAndBoundsCheck(cipher, cipherOffset, plainLen); + RangeUtil.nullAndBoundsCheck(plain, plainOffset, plainLen); + RangeUtil.nullAndBoundsCheck(cipher, cipherOffset, plainLen); int oddBytes = plainLen % numBytes; int len = encrypt(plain, plainOffset, (plainLen - oddBytes),
--- a/src/share/classes/com/sun/crypto/provider/PBES1Core.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/com/sun/crypto/provider/PBES1Core.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2019, 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 @@ -268,17 +268,20 @@ if (algo.equals("DES")) { // P || S (password concatenated with salt) - byte[] concat = new byte[Math.addExact(passwdBytes.length, salt.length)]; - System.arraycopy(passwdBytes, 0, concat, 0, passwdBytes.length); - System.arraycopy(salt, 0, concat, passwdBytes.length, salt.length); - - // digest P || S with c iterations - byte[] toBeHashed = concat; - for (int i = 0; i < iCount; i++) { + md.update(passwdBytes); + md.update(salt); + // digest P || S with iCount iterations + // first iteration + byte[] toBeHashed = md.digest(); // this resets the digest + // remaining (iCount - 1) iterations + for (int i = 1; i < iCount; ++i) { md.update(toBeHashed); - toBeHashed = md.digest(); // this resets the digest + try { + md.digest(toBeHashed, 0, toBeHashed.length); + } catch (DigestException e) { + throw new ProviderException("Internal error", e); + } } - Arrays.fill(concat, (byte)0x00); result = toBeHashed; } else if (algo.equals("DESede")) { // if the 2 salt halves are the same, invert one of them @@ -305,13 +308,19 @@ result = new byte[DESedeKeySpec.DES_EDE_KEY_LEN + DESConstants.DES_BLOCK_SIZE]; for (i = 0; i < 2; i++) { - toBeHashed = new byte[salt.length/2]; - System.arraycopy(salt, i*(salt.length/2), toBeHashed, 0, - toBeHashed.length); - for (int j=0; j < iCount; j++) { + // first iteration + md.update(salt, i * (salt.length / 2), salt.length / 2); + md.update(passwdBytes); + toBeHashed = md.digest(); + // remaining (iCount - 1) iterations + for (int j = 1; j < iCount; ++j) { md.update(toBeHashed); md.update(passwdBytes); - toBeHashed = md.digest(); + try { + md.digest(toBeHashed, 0, toBeHashed.length); + } catch (DigestException e) { + throw new ProviderException("Internal error", e); + } } System.arraycopy(toBeHashed, 0, result, i*16, toBeHashed.length);
--- a/src/share/classes/com/sun/crypto/provider/PCBC.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/com/sun/crypto/provider/PCBC.java Wed Oct 23 15:35:04 2019 +0100 @@ -27,8 +27,6 @@ import java.security.InvalidKeyException; import java.security.ProviderException; -import sun.security.util.ArrayUtil; - /** * This class represents ciphers in Plaintext Cipher Block Chaining (PCBC) @@ -137,9 +135,9 @@ int encrypt(byte[] plain, int plainOffset, int plainLen, byte[] cipher, int cipherOffset) { - ArrayUtil.blockSizeCheck(plainLen, blockSize); - ArrayUtil.nullAndBoundsCheck(plain, plainOffset, plainLen); - ArrayUtil.nullAndBoundsCheck(cipher, cipherOffset, plainLen); + RangeUtil.blockSizeCheck(plainLen, blockSize); + RangeUtil.nullAndBoundsCheck(plain, plainOffset, plainLen); + RangeUtil.nullAndBoundsCheck(cipher, cipherOffset, plainLen); int i; int endIndex = plainOffset + plainLen; @@ -178,9 +176,9 @@ int decrypt(byte[] cipher, int cipherOffset, int cipherLen, byte[] plain, int plainOffset) { - ArrayUtil.blockSizeCheck(cipherLen, blockSize); - ArrayUtil.nullAndBoundsCheck(cipher, cipherOffset, cipherLen); - ArrayUtil.nullAndBoundsCheck(plain, plainOffset, cipherLen); + RangeUtil.blockSizeCheck(cipherLen, blockSize); + RangeUtil.nullAndBoundsCheck(cipher, cipherOffset, cipherLen); + RangeUtil.nullAndBoundsCheck(plain, plainOffset, cipherLen); int i; int endIndex = cipherOffset + cipherLen;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/classes/com/sun/crypto/provider/Preconditions.java Wed Oct 23 15:35:04 2019 +0100 @@ -0,0 +1,345 @@ +/* + * Copyright (c) 2016, 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.crypto.provider; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.function.BiFunction; +import java.util.function.Function; + +/** + * Utility methods to check if state or arguments are correct. + * + */ +public class Preconditions { + + /** + * Maps out-of-bounds values to a runtime exception. + * + * @param checkKind the kind of bounds check, whose name may correspond + * to the name of one of the range check methods, checkIndex, + * checkFromToIndex, checkFromIndexSize + * @param args the out-of-bounds arguments that failed the range check. + * If the checkKind corresponds a the name of a range check method + * then the bounds arguments are those that can be passed in order + * to the method. + * @param oobef the exception formatter that when applied with a checkKind + * and a list out-of-bounds arguments returns a runtime exception. + * If {@code null} then, it is as if an exception formatter was + * supplied that returns {@link IndexOutOfBoundsException} for any + * given arguments. + * @return the runtime exception + */ + private static RuntimeException outOfBounds( + BiFunction<String, List<Integer>, ? extends RuntimeException> oobef, + String checkKind, + Integer... args) { + List<Integer> largs = Collections.unmodifiableList(Arrays.asList(args)); + RuntimeException e = oobef == null + ? null : oobef.apply(checkKind, largs); + return e == null + ? new IndexOutOfBoundsException(outOfBoundsMessage(checkKind, largs)) : e; + } + + private static RuntimeException outOfBoundsCheckIndex( + BiFunction<String, List<Integer>, ? extends RuntimeException> oobe, + int index, int length) { + return outOfBounds(oobe, "checkIndex", index, length); + } + + private static RuntimeException outOfBoundsCheckFromToIndex( + BiFunction<String, List<Integer>, ? extends RuntimeException> oobe, + int fromIndex, int toIndex, int length) { + return outOfBounds(oobe, "checkFromToIndex", fromIndex, toIndex, length); + } + + private static RuntimeException outOfBoundsCheckFromIndexSize( + BiFunction<String, List<Integer>, ? extends RuntimeException> oobe, + int fromIndex, int size, int length) { + return outOfBounds(oobe, "checkFromIndexSize", fromIndex, size, length); + } + + /** + * Returns an out-of-bounds exception formatter from an given exception + * factory. The exception formatter is a function that formats an + * out-of-bounds message from its arguments and applies that message to the + * given exception factory to produce and relay an exception. + * + * <p>The exception formatter accepts two arguments: a {@code String} + * describing the out-of-bounds range check that failed, referred to as the + * <em>check kind</em>; and a {@code List<Integer>} containing the + * out-of-bound integer values that failed the check. The list of + * out-of-bound values is not modified. + * + * <p>Three check kinds are supported {@code checkIndex}, + * {@code checkFromToIndex} and {@code checkFromIndexSize} corresponding + * respectively to the specified application of an exception formatter as an + * argument to the out-of-bounds range check methods + * {@link #checkIndex(int, int, BiFunction) checkIndex}, + * {@link #checkFromToIndex(int, int, int, BiFunction) checkFromToIndex}, and + * {@link #checkFromIndexSize(int, int, int, BiFunction) checkFromIndexSize}. + * Thus a supported check kind corresponds to a method name and the + * out-of-bound integer values correspond to method argument values, in + * order, preceding the exception formatter argument (similar in many + * respects to the form of arguments required for a reflective invocation of + * such a range check method). + * + * <p>Formatter arguments conforming to such supported check kinds will + * produce specific exception messages describing failed out-of-bounds + * checks. Otherwise, more generic exception messages will be produced in + * any of the following cases: the check kind is supported but fewer + * or more out-of-bounds values are supplied, the check kind is not + * supported, the check kind is {@code null}, or the list of out-of-bound + * values is {@code null}. + * + * @apiNote + * This method produces an out-of-bounds exception formatter that can be + * passed as an argument to any of the supported out-of-bounds range check + * methods declared by {@code Objects}. For example, a formatter producing + * an {@code ArrayIndexOutOfBoundsException} may be produced and stored on a + * {@code static final} field as follows: + * <pre>{@code + * static final + * BiFunction<String, List<Integer>, ArrayIndexOutOfBoundsException> AIOOBEF = + * outOfBoundsExceptionFormatter(ArrayIndexOutOfBoundsException::new); + * }</pre> + * The formatter instance {@code AIOOBEF} may be passed as an argument to an + * out-of-bounds range check method, such as checking if an {@code index} + * is within the bounds of a {@code limit}: + * <pre>{@code + * checkIndex(index, limit, AIOOBEF); + * }</pre> + * If the bounds check fails then the range check method will throw an + * {@code ArrayIndexOutOfBoundsException} with an appropriate exception + * message that is a produced from {@code AIOOBEF} as follows: + * <pre>{@code + * AIOOBEF.apply("checkIndex", List.of(index, limit)); + * }</pre> + * + * @param f the exception factory, that produces an exception from a message + * where the message is produced and formatted by the returned + * exception formatter. If this factory is stateless and side-effect + * free then so is the returned formatter. + * Exceptions thrown by the factory are relayed to the caller + * of the returned formatter. + * @param <X> the type of runtime exception to be returned by the given + * exception factory and relayed by the exception formatter + * @return the out-of-bounds exception formatter + */ + public static <X extends RuntimeException> + BiFunction<String, List<Integer>, X> outOfBoundsExceptionFormatter(Function<String, X> f) { + // Use anonymous class to avoid bootstrap issues if this method is + // used early in startup + return new BiFunction<String, List<Integer>, X>() { + @Override + public X apply(String checkKind, List<Integer> args) { + return f.apply(outOfBoundsMessage(checkKind, args)); + } + }; + } + + private static String outOfBoundsMessage(String checkKind, List<Integer> args) { + if (checkKind == null && args == null) { + return String.format("Range check failed"); + } else if (checkKind == null) { + return String.format("Range check failed: %s", args); + } else if (args == null) { + return String.format("Range check failed: %s", checkKind); + } + + int argSize = 0; + switch (checkKind) { + case "checkIndex": + argSize = 2; + break; + case "checkFromToIndex": + case "checkFromIndexSize": + argSize = 3; + break; + default: + } + + // Switch to default if fewer or more arguments than required are supplied + switch ((args.size() != argSize) ? "" : checkKind) { + case "checkIndex": + return String.format("Index %d out-of-bounds for length %d", + args.get(0), args.get(1)); + case "checkFromToIndex": + return String.format("Range [%d, %d) out-of-bounds for length %d", + args.get(0), args.get(1), args.get(2)); + case "checkFromIndexSize": + return String.format("Range [%d, %<d + %d) out-of-bounds for length %d", + args.get(0), args.get(1), args.get(2)); + default: + return String.format("Range check failed: %s %s", checkKind, args); + } + } + + /** + * Checks if the {@code index} is within the bounds of the range from + * {@code 0} (inclusive) to {@code length} (exclusive). + * + * <p>The {@code index} is defined to be out-of-bounds if any of the + * following inequalities is true: + * <ul> + * <li>{@code index < 0}</li> + * <li>{@code index >= length}</li> + * <li>{@code length < 0}, which is implied from the former inequalities</li> + * </ul> + * + * <p>If the {@code index} is out-of-bounds, then a runtime exception is + * thrown that is the result of applying the following arguments to the + * exception formatter: the name of this method, {@code checkIndex}; + * and an unmodifiable list integers whose values are, in order, the + * out-of-bounds arguments {@code index} and {@code length}. + * + * @param <X> the type of runtime exception to throw if the arguments are + * out-of-bounds + * @param index the index + * @param length the upper-bound (exclusive) of the range + * @param oobef the exception formatter that when applied with this + * method name and out-of-bounds arguments returns a runtime + * exception. If {@code null} or returns {@code null} then, it is as + * if an exception formatter produced from an invocation of + * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} is used + * instead (though it may be more efficient). + * Exceptions thrown by the formatter are relayed to the caller. + * @return {@code index} if it is within bounds of the range + * @throws X if the {@code index} is out-of-bounds and the exception + * formatter is non-{@code null} + * @throws IndexOutOfBoundsException if the {@code index} is out-of-bounds + * and the exception formatter is {@code null} + * @since 9 + * + * @implNote + * This method is made intrinsic in optimizing compilers to guide them to + * perform unsigned comparisons of the index and length when it is known the + * length is a non-negative value (such as that of an array length or from + * the upper bound of a loop) + */ + public static <X extends RuntimeException> + int checkIndex(int index, int length, + BiFunction<String, List<Integer>, X> oobef) { + if (index < 0 || index >= length) + throw outOfBoundsCheckIndex(oobef, index, length); + return index; + } + + /** + * Checks if the sub-range from {@code fromIndex} (inclusive) to + * {@code toIndex} (exclusive) is within the bounds of range from {@code 0} + * (inclusive) to {@code length} (exclusive). + * + * <p>The sub-range is defined to be out-of-bounds if any of the following + * inequalities is true: + * <ul> + * <li>{@code fromIndex < 0}</li> + * <li>{@code fromIndex > toIndex}</li> + * <li>{@code toIndex > length}</li> + * <li>{@code length < 0}, which is implied from the former inequalities</li> + * </ul> + * + * <p>If the sub-range is out-of-bounds, then a runtime exception is + * thrown that is the result of applying the following arguments to the + * exception formatter: the name of this method, {@code checkFromToIndex}; + * and an unmodifiable list integers whose values are, in order, the + * out-of-bounds arguments {@code fromIndex}, {@code toIndex}, and {@code length}. + * + * @param <X> the type of runtime exception to throw if the arguments are + * out-of-bounds + * @param fromIndex the lower-bound (inclusive) of the sub-range + * @param toIndex the upper-bound (exclusive) of the sub-range + * @param length the upper-bound (exclusive) the range + * @param oobef the exception formatter that when applied with this + * method name and out-of-bounds arguments returns a runtime + * exception. If {@code null} or returns {@code null} then, it is as + * if an exception formatter produced from an invocation of + * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} is used + * instead (though it may be more efficient). + * Exceptions thrown by the formatter are relayed to the caller. + * @return {@code fromIndex} if the sub-range within bounds of the range + * @throws X if the sub-range is out-of-bounds and the exception factory + * function is non-{@code null} + * @throws IndexOutOfBoundsException if the sub-range is out-of-bounds and + * the exception factory function is {@code null} + * @since 9 + */ + public static <X extends RuntimeException> + int checkFromToIndex(int fromIndex, int toIndex, int length, + BiFunction<String, List<Integer>, X> oobef) { + if (fromIndex < 0 || fromIndex > toIndex || toIndex > length) + throw outOfBoundsCheckFromToIndex(oobef, fromIndex, toIndex, length); + return fromIndex; + } + + /** + * Checks if the sub-range from {@code fromIndex} (inclusive) to + * {@code fromIndex + size} (exclusive) is within the bounds of range from + * {@code 0} (inclusive) to {@code length} (exclusive). + * + * <p>The sub-range is defined to be out-of-bounds if any of the following + * inequalities is true: + * <ul> + * <li>{@code fromIndex < 0}</li> + * <li>{@code size < 0}</li> + * <li>{@code fromIndex + size > length}, taking into account integer overflow</li> + * <li>{@code length < 0}, which is implied from the former inequalities</li> + * </ul> + * + * <p>If the sub-range is out-of-bounds, then a runtime exception is + * thrown that is the result of applying the following arguments to the + * exception formatter: the name of this method, {@code checkFromIndexSize}; + * and an unmodifiable list integers whose values are, in order, the + * out-of-bounds arguments {@code fromIndex}, {@code size}, and + * {@code length}. + * + * @param <X> the type of runtime exception to throw if the arguments are + * out-of-bounds + * @param fromIndex the lower-bound (inclusive) of the sub-interval + * @param size the size of the sub-range + * @param length the upper-bound (exclusive) of the range + * @param oobef the exception formatter that when applied with this + * method name and out-of-bounds arguments returns a runtime + * exception. If {@code null} or returns {@code null} then, it is as + * if an exception formatter produced from an invocation of + * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} is used + * instead (though it may be more efficient). + * Exceptions thrown by the formatter are relayed to the caller. + * @return {@code fromIndex} if the sub-range within bounds of the range + * @throws X if the sub-range is out-of-bounds and the exception factory + * function is non-{@code null} + * @throws IndexOutOfBoundsException if the sub-range is out-of-bounds and + * the exception factory function is {@code null} + * @since 9 + */ + public static <X extends RuntimeException> + int checkFromIndexSize(int fromIndex, int size, int length, + BiFunction<String, List<Integer>, X> oobef) { + if ((length | fromIndex | size) < 0 || size > length - fromIndex) + throw outOfBoundsCheckFromIndexSize(oobef, fromIndex, size, length); + return fromIndex; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/classes/com/sun/crypto/provider/RangeUtil.java Wed Oct 23 15:35:04 2019 +0100 @@ -0,0 +1,53 @@ +/* + * 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.crypto.provider; + +import java.util.List; +import java.util.function.BiFunction; +import java.security.*; + +/** + * This class holds the various utility methods for range checks. + */ + +final class RangeUtil { + + private static final BiFunction<String, List<Integer>, + ArrayIndexOutOfBoundsException> AIOOBE_SUPPLIER = + Preconditions.outOfBoundsExceptionFormatter + (ArrayIndexOutOfBoundsException::new); + + public static void blockSizeCheck(int len, int blockSize) { + if ((len % blockSize) != 0) { + throw new ProviderException("Internal error in input buffering"); + } + } + + public static void nullAndBoundsCheck(byte[] array, int offset, int len) { + // NPE is thrown when array is null + Preconditions.checkFromIndexSize(offset, len, array.length, AIOOBE_SUPPLIER); + } +}
--- a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java Wed Oct 23 15:35:04 2019 +0100 @@ -535,6 +535,34 @@ } } + private int getBrightness(Color c) { + return Math.max(c.getRed(), Math.max(c.getGreen(), c.getBlue())); + } + + private int getMaxColorDiff(Color c1, Color c2) { + return Math.max(Math.abs(c1.getRed() - c2.getRed()), + Math.max(Math.abs(c1.getGreen() - c2.getGreen()), + Math.abs(c1.getBlue() - c2.getBlue()))); + } + + private int scaleColorComponent(int color, double scaleFactor) { + return (int)(color + color * scaleFactor); + } + private Color deriveColor(Color originalColor, int originalBrightness, + int targetBrightness) { + int r, g, b; + if (originalBrightness == 0) { + r = g = b = targetBrightness; + } else { + double scaleFactor = (targetBrightness - originalBrightness) + / originalBrightness ; + r = scaleColorComponent(originalColor.getRed(), scaleFactor); + g = scaleColorComponent(originalColor.getGreen(), scaleFactor); + b = scaleColorComponent(originalColor.getBlue(), scaleFactor); + } + return new Color(r, g, b); + } + // // MENU // @@ -551,6 +579,57 @@ int gtkState = GTKLookAndFeel.synthStateToGTKState( context.getRegion(), context.getComponentState()); if (gtkState == SynthConstants.MOUSE_OVER) { + if (GTKLookAndFeel.is3() && context.getRegion() == Region.MENU) { + GTKStyle style = (GTKStyle)context.getStyle(); + Color highlightColor = style.getGTKColor( + GTKEngine.WidgetType.MENU_ITEM.ordinal(), + gtkState, ColorType.BACKGROUND.getID()); + Color backgroundColor = style.getGTKColor( + GTKEngine.WidgetType.MENU_BAR.ordinal(), + SynthConstants.ENABLED, ColorType.BACKGROUND.getID()); + + int minBrightness = 0, maxBrightness = 255; + int minBrightnessDifference = 100; + int actualBrightnessDifference = + getMaxColorDiff(highlightColor, backgroundColor); + if (actualBrightnessDifference < minBrightnessDifference) { + int highlightBrightness = + getBrightness(highlightColor); + int backgroundBrightness = + getBrightness(backgroundColor); + int originalHighlightBrightness = + highlightBrightness; + if (highlightBrightness >= backgroundBrightness) { + if (backgroundBrightness + minBrightnessDifference <= + maxBrightness) { + highlightBrightness = + backgroundBrightness + + minBrightnessDifference; + } else { + highlightBrightness = + backgroundBrightness - + minBrightnessDifference; + } + } else { + if (backgroundBrightness - minBrightnessDifference >= + minBrightness) { + highlightBrightness = + backgroundBrightness - + minBrightnessDifference; + } else { + highlightBrightness = + backgroundBrightness + + minBrightnessDifference; + } + } + + g.setColor(deriveColor(highlightColor, + originalHighlightBrightness, + highlightBrightness)); + g.fillRect(x, y, w, h); + return; + } + } Region id = Region.MENU_ITEM; synchronized (UNIXToolkit.GTK_LOCK) { if (! ENGINE.paintCachedImage(g, x, y, w, h, id)) {
--- a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java Wed Oct 23 15:35:04 2019 +0100 @@ -200,6 +200,14 @@ return getGTKColor(null, state, type); } + Color getGTKColor(int widgetType, int state, int colorType) { + synchronized (sun.awt.UNIXToolkit.GTK_LOCK) { + int rgb = nativeGetColorForState(widgetType, state, + colorType); + return new ColorUIResource(rgb); + } + } + /** * Returns the color for the specified state. *
--- a/src/share/classes/com/sun/jndi/ldap/BerDecoder.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/com/sun/jndi/ldap/BerDecoder.java Wed Oct 23 15:35:04 2019 +0100 @@ -186,12 +186,16 @@ *</pre></blockquote> */ private int parseIntWithTag(int tag) throws DecodeException { - - if (parseByte() != tag) { + // Ber could have been reset; + String s; + if (offset > 0) { + s = Integer.toString(buf[offset - 1] & 0xff); + } else { + s = "Empty tag"; + } throw new DecodeException("Encountered ASN.1 tag " + - Integer.toString(buf[offset - 1] & 0xff) + - " (expected tag " + Integer.toString(tag) + ")"); + s + " (expected tag " + Integer.toString(tag) + ")"); } int len = parseLength();
--- a/src/share/classes/com/sun/jndi/ldap/Connection.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/com/sun/jndi/ldap/Connection.java Wed Oct 23 15:35:04 2019 +0100 @@ -453,65 +453,29 @@ /** * Reads a reply; waits until one is ready. */ - BerDecoder readReply(LdapRequest ldr) - throws IOException, NamingException { + BerDecoder readReply(LdapRequest ldr) throws IOException, NamingException { BerDecoder rber; - // Track down elapsed time to workaround spurious wakeups - long elapsedMilli = 0; - long elapsedNano = 0; - - while (((rber = ldr.getReplyBer()) == null) && - (readTimeout <= 0 || elapsedMilli < readTimeout)) - { - try { - // If socket closed, don't even try - synchronized (this) { - if (sock == null) { - throw new ServiceUnavailableException(host + ":" + port + - "; socket closed"); - } - } - synchronized (ldr) { - // check if condition has changed since our last check - rber = ldr.getReplyBer(); - if (rber == null) { - if (readTimeout > 0) { // Socket read timeout is specified - long beginNano = System.nanoTime(); - - // will be woken up before readTimeout if reply is - // available - ldr.wait(readTimeout - elapsedMilli); - elapsedNano += (System.nanoTime() - beginNano); - elapsedMilli += elapsedNano / 1000_000; - elapsedNano %= 1000_000; - - } else { - // no timeout is set so we wait infinitely until - // a response is received - // https://docs.oracle.com/javase/8/docs/technotes/guides/jndi/jndi-ldap.html#PROP - ldr.wait(); - } - } else { - break; - } - } - } catch (InterruptedException ex) { - throw new InterruptedNamingException( - "Interrupted during LDAP operation"); - } + try { + // if no timeout is set so we wait infinitely until + // a response is received + // http://docs.oracle.com/javase/8/docs/technotes/guides/jndi/jndi-ldap.html#PROP + rber = ldr.getReplyBer(readTimeout); + } catch (InterruptedException ex) { + throw new InterruptedNamingException( + "Interrupted during LDAP operation"); } - if ((rber == null) && (elapsedMilli >= readTimeout)) { + if (rber == null) { abandonRequest(ldr, null); - throw new NamingException("LDAP response read timed out, timeout used:" + throw new NamingException( + "LDAP response read timed out, timeout used:" + readTimeout + "ms." ); } return rber; } - //////////////////////////////////////////////////////////////////////////// // // Methods to add, find, delete, and abandon requests made to server @@ -705,14 +669,11 @@ if (nparent) { LdapRequest ldr = pendingRequests; while (ldr != null) { - - synchronized (ldr) { - ldr.notify(); + ldr.close(); ldr = ldr.next; } } } - } if (nparent) { parent.processConnectionClosure(); } @@ -800,7 +761,7 @@ * the safest thing to do is to shut it down. */ - private Object pauseLock = new Object(); // lock for reader to wait on while paused + private final Object pauseLock = new Object(); // lock for reader to wait on while paused private boolean paused = false; // paused state of reader /*
--- a/src/share/classes/com/sun/jndi/ldap/LdapRequest.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/com/sun/jndi/ldap/LdapRequest.java Wed Oct 23 15:35:04 2019 +0100 @@ -29,55 +29,52 @@ import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import javax.naming.CommunicationException; +import java.util.concurrent.TimeUnit; final class LdapRequest { + private final static BerDecoder EOF = new BerDecoder(new byte[]{}, -1, 0); + LdapRequest next; // Set/read in synchronized Connection methods - int msgId; // read-only + final int msgId; // read-only - private int gotten = 0; - private BlockingQueue<BerDecoder> replies; - private int highWatermark = -1; - private boolean cancelled = false; - private boolean pauseAfterReceipt = false; - private boolean completed = false; - - LdapRequest(int msgId, boolean pause) { - this(msgId, pause, -1); - } + private final BlockingQueue<BerDecoder> replies; + private volatile boolean cancelled; + private volatile boolean closed; + private volatile boolean completed; + private final boolean pauseAfterReceipt; LdapRequest(int msgId, boolean pause, int replyQueueCapacity) { this.msgId = msgId; this.pauseAfterReceipt = pause; if (replyQueueCapacity == -1) { - this.replies = new LinkedBlockingQueue<BerDecoder>(); + this.replies = new LinkedBlockingQueue<>(); } else { - this.replies = - new LinkedBlockingQueue<BerDecoder>(replyQueueCapacity); - highWatermark = (replyQueueCapacity * 80) / 100; // 80% capacity + this.replies = new LinkedBlockingQueue<>(8 * replyQueueCapacity / 10); } } - synchronized void cancel() { + void cancel() { cancelled = true; + replies.offer(EOF); + } - // Unblock reader of pending request - // Should only ever have atmost one waiter - notify(); + synchronized void close() { + closed = true; + replies.offer(EOF); + } + + private boolean isClosed() { + return closed && (replies.size() == 0 || replies.peek() == EOF); } synchronized boolean addReplyBer(BerDecoder ber) { - if (cancelled) { + // check the closed boolean value here as we don't want anything + // to be added to the queue after close() has been called. + if (cancelled || closed) { return false; } - // Add a new reply to the queue of unprocessed replies. - try { - replies.put(ber); - } catch (InterruptedException e) { - // ignore - } - // peek at the BER buffer to check if it is a SearchResultDone PDU try { ber.parseSeq(null); @@ -88,33 +85,38 @@ } ber.reset(); - notify(); // notify anyone waiting for reply - /* - * If a queue capacity has been set then trigger a pause when the - * queue has filled to 80% capacity. Later, when the queue has drained - * then the reader gets unpaused. - */ - if (highWatermark != -1 && replies.size() >= highWatermark) { - return true; // trigger the pause + // Add a new reply to the queue of unprocessed replies. + try { + replies.put(ber); + } catch (InterruptedException e) { + // ignore } + return pauseAfterReceipt; } - synchronized BerDecoder getReplyBer() throws CommunicationException { + BerDecoder getReplyBer(long millis) throws CommunicationException, + InterruptedException { + if (cancelled) { + throw new CommunicationException("Request: " + msgId + + " cancelled"); + } + if (isClosed()) { + return null; + } + + BerDecoder result = millis > 0 ? + replies.poll(millis, TimeUnit.MILLISECONDS) : replies.take(); + if (cancelled) { throw new CommunicationException("Request: " + msgId + " cancelled"); } - /* - * Remove a reply if the queue is not empty. - * poll returns null if queue is empty. - */ - BerDecoder reply = replies.poll(); - return reply; + return result == EOF ? null : result; } - synchronized boolean hasSearchCompleted() { + boolean hasSearchCompleted() { return completed; } }
--- a/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -668,7 +668,11 @@ // check to renew credentials if (!isCurrent(cred)) { if (renewTGT) { - cred = renewCredentials(cred); + Credentials newCred = renewCredentials(cred); + if (newCred != null) { + newCred.setProxy(cred.getProxy()); + } + cred = newCred; } else { // credentials have expired cred = null; @@ -1074,6 +1078,10 @@ // create Kerberos Ticket if (isInitiator) { kerbTicket = Krb5Util.credsToTicket(cred); + if (cred.getProxy() != null) { + KerberosSecrets.getJavaxSecurityAuthKerberosAccess() + .kerberosTicketSetProxy(kerbTicket,Krb5Util.credsToTicket(cred.getProxy())); + } } if (storeKey && encKeys != null) {
--- a/src/share/classes/java/awt/Font.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/java/awt/Font.java Wed Oct 23 15:35:04 2019 +0100 @@ -1750,6 +1750,7 @@ // value is the default. if (fRequestedAttributes != null) { + try { values = getAttributeValues(); // init AttributeValues extras = AttributeValues.fromSerializableHashtable(fRequestedAttributes); @@ -1759,10 +1760,13 @@ values = getAttributeValues().merge(extras); this.nonIdentityTx = values.anyNonDefault(EXTRA_MASK); this.hasLayoutAttributes = values.anyNonDefault(LAYOUT_MASK); - + } catch (Throwable t) { + throw new IOException(t); + } finally { fRequestedAttributes = null; // don't need it any more } } + } /** * Returns the number of glyphs in this <code>Font</code>. Glyph codes
--- a/src/share/classes/java/io/FilePermission.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/java/io/FilePermission.java Wed Oct 23 15:35:04 2019 +0100 @@ -25,12 +25,16 @@ package java.io; +import java.net.URI; +import java.nio.file.InvalidPathException; import java.security.*; import java.util.Enumeration; import java.util.List; import java.util.ArrayList; import java.util.Vector; import java.util.Collections; + +import sun.nio.fs.DefaultFileSystemProvider; import sun.security.util.SecurityConstants; /** @@ -152,6 +156,8 @@ private transient String cpath; + private transient boolean invalid; // whether input path is invalid + // static Strings used by init(int mask) private static final char RECURSIVE_CHAR = '-'; private static final char WILD_CHAR = '*'; @@ -174,6 +180,14 @@ private static final long serialVersionUID = 7930732926638008763L; /** + * Always use the internal default file system, in case it was modified + * with java.nio.file.spi.DefaultFileSystemProvider. + */ + private static final java.nio.file.FileSystem builtInFS = + DefaultFileSystemProvider.create() + .getFileSystem(URI.create("file:///")); + + /** * initialize a FilePermission object. Common to all constructors. * Also called during de-serialization. * @@ -199,6 +213,20 @@ return; } + // Validate path by platform's default file system + // Note: this check does not apply during FilePermission + // class initialization. + if (builtInFS != null) { + try { + String name = cpath.endsWith("*") ? + cpath.substring(0, cpath.length() - 1) + "-" : cpath; + builtInFS.getPath(new File(name).getPath()); + } catch (InvalidPathException ipe) { + invalid = true; + return; + } + } + // store only the canonical cpath if possible cpath = AccessController.doPrivileged(new PrivilegedAction<String>() { public String run() { @@ -335,6 +363,12 @@ * @return the effective mask */ boolean impliesIgnoreMask(FilePermission that) { + if (this == that) { + return true; + } + if (this.invalid || that.invalid) { + return false; + } if (this.directory) { if (this.recursive) { // make sure that.path is longer then path so @@ -395,6 +429,9 @@ FilePermission that = (FilePermission) obj; + if (this.invalid || that.invalid) { + return false; + } return (this.mask == that.mask) && this.cpath.equals(that.cpath) && (this.directory == that.directory) &&
--- a/src/share/classes/java/io/LineNumberReader.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/java/io/LineNumberReader.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2019, 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 @@ -259,6 +259,11 @@ */ public void mark(int readAheadLimit) throws IOException { synchronized (lock) { + // If the most recently read character is '\r', then increment the + // read ahead limit as in this case if the next character is '\n', + // two characters would actually be read by the next read(). + if (skipLF) + readAheadLimit++; super.mark(readAheadLimit); markedLineNumber = lineNumber; markedSkipLF = skipLF;
--- a/src/share/classes/java/net/NetPermission.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/java/net/NetPermission.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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 @@ -151,6 +151,15 @@ creating a ProtectionDomain/CodeSource for a class even though that class really didn't come from that location.</td> * </tr> + * + * <tr> + * <th scope="row">setSocketImpl</th> + * <td>The ability to create a sub-class of Socket or ServerSocket with a + * user specified SocketImpl.</td> + * <td>Malicious user-defined SocketImpls can change the behavior of + * Socket and ServerSocket in surprising ways, by virtue of their + * ability to access the protected fields of SocketImpl.</td> + * </tr> * </table> * * @see java.security.BasicPermission
--- a/src/share/classes/java/net/ServerSocket.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/java/net/ServerSocket.java Wed Oct 23 15:35:04 2019 +0100 @@ -31,6 +31,8 @@ import java.security.AccessController; import java.security.PrivilegedExceptionAction; +import sun.security.util.SecurityConstants; + /** * This class implements server sockets. A server socket waits for * requests to come in over the network. It performs some operation @@ -71,12 +73,25 @@ /** * Package-private constructor to create a ServerSocket associated with * the given SocketImpl. + * + * @throws SecurityException if a security manager is set and + * its {@code checkPermission} method doesn't allow + * {@code NetPermission("setSocketImpl")}. */ ServerSocket(SocketImpl impl) { + checkPermission(); this.impl = impl; impl.setServerSocket(this); } + private static Void checkPermission() { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkPermission(SecurityConstants.SET_SOCKETIMPL_PERMISSION); + } + return null; + } + /** * Creates an unbound server socket. *
--- a/src/share/classes/java/net/Socket.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/java/net/Socket.java Wed Oct 23 15:35:04 2019 +0100 @@ -25,6 +25,8 @@ package java.net; +import sun.security.util.SecurityConstants; + import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; @@ -159,9 +161,14 @@ * * @exception SocketException if there is an error in the underlying protocol, * such as a TCP error. + * + * @throws SecurityException if {@code impl} is non-null and a security manager is set + * and its {@code checkPermission} method doesn't allow {@code NetPermission("setSocketImpl")}. + * * @since JDK1.1 */ protected Socket(SocketImpl impl) throws SocketException { + checkPermission(impl); this.impl = impl; if (impl != null) { checkOldImpl(); @@ -169,6 +176,17 @@ } } + private static Void checkPermission(SocketImpl impl) { + if (impl == null) { + return null; + } + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkPermission(SecurityConstants.SET_SOCKETIMPL_PERMISSION); + } + return null; + } + /** * Creates a stream socket and connects it to the specified port * number on the named host.
--- a/src/share/classes/java/net/URL.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/java/net/URL.java Wed Oct 23 15:35:04 2019 +0100 @@ -428,6 +428,16 @@ throw new MalformedURLException(s); } } + if ("jar".equalsIgnoreCase(protocol)) { + if (handler instanceof sun.net.www.protocol.jar.Handler) { + // URL.openConnection() would throw a confusing exception + // so generate a better exception here instead. + String s = ((sun.net.www.protocol.jar.Handler) handler).checkNestedProtocol(file); + if (s != null) { + throw new MalformedURLException(s); + } + } + } } /**
--- a/src/share/classes/java/util/Collections.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/java/util/Collections.java Wed Oct 23 15:35:04 2019 +0100 @@ -459,7 +459,7 @@ for (int i=size; i>1; i--) swap(list, i-1, rnd.nextInt(i)); } else { - Object arr[] = list.toArray(); + Object[] arr = list.toArray(); // Shuffle array for (int i=size; i>1; i--) @@ -5062,6 +5062,53 @@ return new CopiesList<>(toIndex - fromIndex, element); } + @Override + public int hashCode() { + if (n == 0) return 1; + // hashCode of n repeating elements is 31^n + elementHash * Sum(31^k, k = 0..n-1) + // this implementation completes in O(log(n)) steps taking advantage of + // 31^(2*n) = (31^n)^2 and Sum(31^k, k = 0..(2*n-1)) = Sum(31^k, k = 0..n-1) * (31^n + 1) + int pow = 31; + int sum = 1; + for (int i = Integer.numberOfLeadingZeros(n) + 1; i < Integer.SIZE; i++) { + sum *= pow + 1; + pow *= pow; + if ((n << i) < 0) { + pow *= 31; + sum = sum * 31 + 1; + } + } + return pow + sum * (element == null ? 0 : element.hashCode()); + } + + @Override + public boolean equals(Object o) { + if (o == this) + return true; + if (o instanceof CopiesList) { + CopiesList<?> other = (CopiesList<?>) o; + return n == other.n && (n == 0 || eq(element, other.element)); + } + if (!(o instanceof List)) + return false; + + int remaining = n; + E e = element; + Iterator<?> itr = ((List<?>) o).iterator(); + if (e == null) { + while (itr.hasNext() && remaining-- > 0) { + if (itr.next() != null) + return false; + } + } else { + while (itr.hasNext() && remaining-- > 0) { + if (!e.equals(itr.next())) + return false; + } + } + return remaining == 0 && !itr.hasNext(); + } + // Override default methods in Collection @Override public Stream<E> stream() {
--- a/src/share/classes/java/util/regex/Pattern.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/java/util/regex/Pattern.java Wed Oct 23 15:35:04 2019 +0100 @@ -1348,7 +1348,11 @@ localCount = 0; if (pattern.length() > 0) { - compile(); + try { + compile(); + } catch (StackOverflowError soe) { + throw error("Stack overflow during pattern compilation"); + } } else { root = new Start(lastAccept); matchRoot = lastAccept; @@ -1905,6 +1909,10 @@ int ch = temp[cursor++]; while (ch != 0 && !isLineSeparator(ch)) ch = temp[cursor++]; + if (ch == 0 && cursor > patternLength) { + cursor = patternLength; + ch = temp[cursor++]; + } return ch; } @@ -1915,6 +1923,10 @@ int ch = temp[++cursor]; while (ch != 0 && !isLineSeparator(ch)) ch = temp[++cursor]; + if (ch == 0 && cursor > patternLength) { + cursor = patternLength; + ch = temp[cursor]; + } return ch; }
--- a/src/share/classes/javax/security/auth/kerberos/JavaxSecurityAuthKerberosAccessImpl.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/javax/security/auth/kerberos/JavaxSecurityAuthKerberosAccessImpl.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2019, 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 @@ -26,8 +26,6 @@ package javax.security.auth.kerberos; import sun.security.krb5.JavaxSecurityAuthKerberosAccess; -import sun.security.krb5.EncryptionKey; -import sun.security.krb5.PrincipalName; class JavaxSecurityAuthKerberosAccessImpl implements JavaxSecurityAuthKerberosAccess { @@ -35,4 +33,10 @@ KeyTab ktab) { return ktab.takeSnapshot(); } + public KerberosTicket kerberosTicketGetProxy(KerberosTicket t) { + return t.proxy; + } + public void kerberosTicketSetProxy(KerberosTicket t, KerberosTicket p) { + t.proxy = p; + } }
--- a/src/share/classes/javax/security/auth/kerberos/KerberosTicket.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/javax/security/auth/kerberos/KerberosTicket.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -29,11 +29,13 @@ import java.util.Date; import java.util.Arrays; import java.net.InetAddress; +import java.util.Objects; import javax.crypto.SecretKey; import javax.security.auth.Refreshable; import javax.security.auth.Destroyable; import javax.security.auth.RefreshFailedException; import javax.security.auth.DestroyFailedException; + import sun.misc.HexDumpEncoder; import sun.security.krb5.EncryptionKey; import sun.security.krb5.Asn1Exception; @@ -190,8 +192,13 @@ * @serial */ + private InetAddress[] clientAddresses; - private InetAddress[] clientAddresses; + /** + * Evidence ticket if proxy_impersonator. This field can be accessed + * by KerberosSecrets. It's serialized. + */ + KerberosTicket proxy = null; private transient boolean destroyed = false; @@ -662,6 +669,7 @@ "Renew Till = " + String.valueOf(renewTill) + "\n" + "Client Addresses " + (clientAddresses == null ? " Null " : caddrBuf.toString() + + (proxy == null ? "" : "\nwith a proxy ticket") + "\n")); } @@ -699,6 +707,10 @@ // clientAddress may be null, the array's hashCode is 0 result = result * 37 + Arrays.hashCode(clientAddresses); + + if (proxy != null) { + result = result * 37 + proxy.hashCode(); + } return result * 37 + Arrays.hashCode(flags); } @@ -764,6 +776,10 @@ return false; } + if (!Objects.equals(proxy, otherTicket.proxy)) { + return false; + } + return true; }
--- a/src/share/classes/jdk/internal/util/Preconditions.java Mon Sep 09 17:27:04 2019 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,345 +0,0 @@ -/* - * Copyright (c) 2016, 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 jdk.internal.util; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.function.BiFunction; -import java.util.function.Function; - -/** - * Utility methods to check if state or arguments are correct. - * - */ -public class Preconditions { - - /** - * Maps out-of-bounds values to a runtime exception. - * - * @param checkKind the kind of bounds check, whose name may correspond - * to the name of one of the range check methods, checkIndex, - * checkFromToIndex, checkFromIndexSize - * @param args the out-of-bounds arguments that failed the range check. - * If the checkKind corresponds a the name of a range check method - * then the bounds arguments are those that can be passed in order - * to the method. - * @param oobef the exception formatter that when applied with a checkKind - * and a list out-of-bounds arguments returns a runtime exception. - * If {@code null} then, it is as if an exception formatter was - * supplied that returns {@link IndexOutOfBoundsException} for any - * given arguments. - * @return the runtime exception - */ - private static RuntimeException outOfBounds( - BiFunction<String, List<Integer>, ? extends RuntimeException> oobef, - String checkKind, - Integer... args) { - List<Integer> largs = Collections.unmodifiableList(Arrays.asList(args)); - RuntimeException e = oobef == null - ? null : oobef.apply(checkKind, largs); - return e == null - ? new IndexOutOfBoundsException(outOfBoundsMessage(checkKind, largs)) : e; - } - - private static RuntimeException outOfBoundsCheckIndex( - BiFunction<String, List<Integer>, ? extends RuntimeException> oobe, - int index, int length) { - return outOfBounds(oobe, "checkIndex", index, length); - } - - private static RuntimeException outOfBoundsCheckFromToIndex( - BiFunction<String, List<Integer>, ? extends RuntimeException> oobe, - int fromIndex, int toIndex, int length) { - return outOfBounds(oobe, "checkFromToIndex", fromIndex, toIndex, length); - } - - private static RuntimeException outOfBoundsCheckFromIndexSize( - BiFunction<String, List<Integer>, ? extends RuntimeException> oobe, - int fromIndex, int size, int length) { - return outOfBounds(oobe, "checkFromIndexSize", fromIndex, size, length); - } - - /** - * Returns an out-of-bounds exception formatter from an given exception - * factory. The exception formatter is a function that formats an - * out-of-bounds message from its arguments and applies that message to the - * given exception factory to produce and relay an exception. - * - * <p>The exception formatter accepts two arguments: a {@code String} - * describing the out-of-bounds range check that failed, referred to as the - * <em>check kind</em>; and a {@code List<Integer>} containing the - * out-of-bound integer values that failed the check. The list of - * out-of-bound values is not modified. - * - * <p>Three check kinds are supported {@code checkIndex}, - * {@code checkFromToIndex} and {@code checkFromIndexSize} corresponding - * respectively to the specified application of an exception formatter as an - * argument to the out-of-bounds range check methods - * {@link #checkIndex(int, int, BiFunction) checkIndex}, - * {@link #checkFromToIndex(int, int, int, BiFunction) checkFromToIndex}, and - * {@link #checkFromIndexSize(int, int, int, BiFunction) checkFromIndexSize}. - * Thus a supported check kind corresponds to a method name and the - * out-of-bound integer values correspond to method argument values, in - * order, preceding the exception formatter argument (similar in many - * respects to the form of arguments required for a reflective invocation of - * such a range check method). - * - * <p>Formatter arguments conforming to such supported check kinds will - * produce specific exception messages describing failed out-of-bounds - * checks. Otherwise, more generic exception messages will be produced in - * any of the following cases: the check kind is supported but fewer - * or more out-of-bounds values are supplied, the check kind is not - * supported, the check kind is {@code null}, or the list of out-of-bound - * values is {@code null}. - * - * @apiNote - * This method produces an out-of-bounds exception formatter that can be - * passed as an argument to any of the supported out-of-bounds range check - * methods declared by {@code Objects}. For example, a formatter producing - * an {@code ArrayIndexOutOfBoundsException} may be produced and stored on a - * {@code static final} field as follows: - * <pre>{@code - * static final - * BiFunction<String, List<Integer>, ArrayIndexOutOfBoundsException> AIOOBEF = - * outOfBoundsExceptionFormatter(ArrayIndexOutOfBoundsException::new); - * }</pre> - * The formatter instance {@code AIOOBEF} may be passed as an argument to an - * out-of-bounds range check method, such as checking if an {@code index} - * is within the bounds of a {@code limit}: - * <pre>{@code - * checkIndex(index, limit, AIOOBEF); - * }</pre> - * If the bounds check fails then the range check method will throw an - * {@code ArrayIndexOutOfBoundsException} with an appropriate exception - * message that is a produced from {@code AIOOBEF} as follows: - * <pre>{@code - * AIOOBEF.apply("checkIndex", List.of(index, limit)); - * }</pre> - * - * @param f the exception factory, that produces an exception from a message - * where the message is produced and formatted by the returned - * exception formatter. If this factory is stateless and side-effect - * free then so is the returned formatter. - * Exceptions thrown by the factory are relayed to the caller - * of the returned formatter. - * @param <X> the type of runtime exception to be returned by the given - * exception factory and relayed by the exception formatter - * @return the out-of-bounds exception formatter - */ - public static <X extends RuntimeException> - BiFunction<String, List<Integer>, X> outOfBoundsExceptionFormatter(Function<String, X> f) { - // Use anonymous class to avoid bootstrap issues if this method is - // used early in startup - return new BiFunction<String, List<Integer>, X>() { - @Override - public X apply(String checkKind, List<Integer> args) { - return f.apply(outOfBoundsMessage(checkKind, args)); - } - }; - } - - private static String outOfBoundsMessage(String checkKind, List<Integer> args) { - if (checkKind == null && args == null) { - return String.format("Range check failed"); - } else if (checkKind == null) { - return String.format("Range check failed: %s", args); - } else if (args == null) { - return String.format("Range check failed: %s", checkKind); - } - - int argSize = 0; - switch (checkKind) { - case "checkIndex": - argSize = 2; - break; - case "checkFromToIndex": - case "checkFromIndexSize": - argSize = 3; - break; - default: - } - - // Switch to default if fewer or more arguments than required are supplied - switch ((args.size() != argSize) ? "" : checkKind) { - case "checkIndex": - return String.format("Index %d out-of-bounds for length %d", - args.get(0), args.get(1)); - case "checkFromToIndex": - return String.format("Range [%d, %d) out-of-bounds for length %d", - args.get(0), args.get(1), args.get(2)); - case "checkFromIndexSize": - return String.format("Range [%d, %<d + %d) out-of-bounds for length %d", - args.get(0), args.get(1), args.get(2)); - default: - return String.format("Range check failed: %s %s", checkKind, args); - } - } - - /** - * Checks if the {@code index} is within the bounds of the range from - * {@code 0} (inclusive) to {@code length} (exclusive). - * - * <p>The {@code index} is defined to be out-of-bounds if any of the - * following inequalities is true: - * <ul> - * <li>{@code index < 0}</li> - * <li>{@code index >= length}</li> - * <li>{@code length < 0}, which is implied from the former inequalities</li> - * </ul> - * - * <p>If the {@code index} is out-of-bounds, then a runtime exception is - * thrown that is the result of applying the following arguments to the - * exception formatter: the name of this method, {@code checkIndex}; - * and an unmodifiable list integers whose values are, in order, the - * out-of-bounds arguments {@code index} and {@code length}. - * - * @param <X> the type of runtime exception to throw if the arguments are - * out-of-bounds - * @param index the index - * @param length the upper-bound (exclusive) of the range - * @param oobef the exception formatter that when applied with this - * method name and out-of-bounds arguments returns a runtime - * exception. If {@code null} or returns {@code null} then, it is as - * if an exception formatter produced from an invocation of - * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} is used - * instead (though it may be more efficient). - * Exceptions thrown by the formatter are relayed to the caller. - * @return {@code index} if it is within bounds of the range - * @throws X if the {@code index} is out-of-bounds and the exception - * formatter is non-{@code null} - * @throws IndexOutOfBoundsException if the {@code index} is out-of-bounds - * and the exception formatter is {@code null} - * @since 9 - * - * @implNote - * This method is made intrinsic in optimizing compilers to guide them to - * perform unsigned comparisons of the index and length when it is known the - * length is a non-negative value (such as that of an array length or from - * the upper bound of a loop) - */ - public static <X extends RuntimeException> - int checkIndex(int index, int length, - BiFunction<String, List<Integer>, X> oobef) { - if (index < 0 || index >= length) - throw outOfBoundsCheckIndex(oobef, index, length); - return index; - } - - /** - * Checks if the sub-range from {@code fromIndex} (inclusive) to - * {@code toIndex} (exclusive) is within the bounds of range from {@code 0} - * (inclusive) to {@code length} (exclusive). - * - * <p>The sub-range is defined to be out-of-bounds if any of the following - * inequalities is true: - * <ul> - * <li>{@code fromIndex < 0}</li> - * <li>{@code fromIndex > toIndex}</li> - * <li>{@code toIndex > length}</li> - * <li>{@code length < 0}, which is implied from the former inequalities</li> - * </ul> - * - * <p>If the sub-range is out-of-bounds, then a runtime exception is - * thrown that is the result of applying the following arguments to the - * exception formatter: the name of this method, {@code checkFromToIndex}; - * and an unmodifiable list integers whose values are, in order, the - * out-of-bounds arguments {@code fromIndex}, {@code toIndex}, and {@code length}. - * - * @param <X> the type of runtime exception to throw if the arguments are - * out-of-bounds - * @param fromIndex the lower-bound (inclusive) of the sub-range - * @param toIndex the upper-bound (exclusive) of the sub-range - * @param length the upper-bound (exclusive) the range - * @param oobef the exception formatter that when applied with this - * method name and out-of-bounds arguments returns a runtime - * exception. If {@code null} or returns {@code null} then, it is as - * if an exception formatter produced from an invocation of - * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} is used - * instead (though it may be more efficient). - * Exceptions thrown by the formatter are relayed to the caller. - * @return {@code fromIndex} if the sub-range within bounds of the range - * @throws X if the sub-range is out-of-bounds and the exception factory - * function is non-{@code null} - * @throws IndexOutOfBoundsException if the sub-range is out-of-bounds and - * the exception factory function is {@code null} - * @since 9 - */ - public static <X extends RuntimeException> - int checkFromToIndex(int fromIndex, int toIndex, int length, - BiFunction<String, List<Integer>, X> oobef) { - if (fromIndex < 0 || fromIndex > toIndex || toIndex > length) - throw outOfBoundsCheckFromToIndex(oobef, fromIndex, toIndex, length); - return fromIndex; - } - - /** - * Checks if the sub-range from {@code fromIndex} (inclusive) to - * {@code fromIndex + size} (exclusive) is within the bounds of range from - * {@code 0} (inclusive) to {@code length} (exclusive). - * - * <p>The sub-range is defined to be out-of-bounds if any of the following - * inequalities is true: - * <ul> - * <li>{@code fromIndex < 0}</li> - * <li>{@code size < 0}</li> - * <li>{@code fromIndex + size > length}, taking into account integer overflow</li> - * <li>{@code length < 0}, which is implied from the former inequalities</li> - * </ul> - * - * <p>If the sub-range is out-of-bounds, then a runtime exception is - * thrown that is the result of applying the following arguments to the - * exception formatter: the name of this method, {@code checkFromIndexSize}; - * and an unmodifiable list integers whose values are, in order, the - * out-of-bounds arguments {@code fromIndex}, {@code size}, and - * {@code length}. - * - * @param <X> the type of runtime exception to throw if the arguments are - * out-of-bounds - * @param fromIndex the lower-bound (inclusive) of the sub-interval - * @param size the size of the sub-range - * @param length the upper-bound (exclusive) of the range - * @param oobef the exception formatter that when applied with this - * method name and out-of-bounds arguments returns a runtime - * exception. If {@code null} or returns {@code null} then, it is as - * if an exception formatter produced from an invocation of - * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} is used - * instead (though it may be more efficient). - * Exceptions thrown by the formatter are relayed to the caller. - * @return {@code fromIndex} if the sub-range within bounds of the range - * @throws X if the sub-range is out-of-bounds and the exception factory - * function is non-{@code null} - * @throws IndexOutOfBoundsException if the sub-range is out-of-bounds and - * the exception factory function is {@code null} - * @since 9 - */ - public static <X extends RuntimeException> - int checkFromIndexSize(int fromIndex, int size, int length, - BiFunction<String, List<Integer>, X> oobef) { - if ((length | fromIndex | size) < 0 || size > length - fromIndex) - throw outOfBoundsCheckFromIndexSize(oobef, fromIndex, size, length); - return fromIndex; - } -}
--- a/src/share/classes/sun/font/CMap.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/font/CMap.java Wed Oct 23 15:35:04 2019 +0100 @@ -130,7 +130,7 @@ static final char noSuchChar = (char)0xfffd; static final int SHORTMASK = 0x0000ffff; - static final int INTMASK = 0xffffffff; + static final int INTMASK = 0x7fffffff; static final char[][] converterMaps = new char[7][]; @@ -885,7 +885,11 @@ bbuffer.position(12); bbuffer.get(is32); - nGroups = bbuffer.getInt(); + nGroups = bbuffer.getInt() & INTMASK; + // A map group record is three uint32's making for 12 bytes total + if (bbuffer.remaining() < (12 * (long)nGroups)) { + throw new RuntimeException("Format 8 table exceeded"); + } startCharCode = new int[nGroups]; endCharCode = new int[nGroups]; startGlyphID = new int[nGroups]; @@ -913,9 +917,13 @@ CMapFormat10(ByteBuffer bbuffer, int offset, char[] xlat) { + bbuffer.position(offset+12); firstCode = bbuffer.getInt() & INTMASK; entryCount = bbuffer.getInt() & INTMASK; - bbuffer.position(offset+20); + // each glyph is a uint16, so 2 bytes per value. + if (bbuffer.remaining() < (2 * (long)entryCount)) { + throw new RuntimeException("Format 10 table exceeded"); + } CharBuffer buffer = bbuffer.asCharBuffer(); glyphIdArray = new char[entryCount]; for (int i=0; i< entryCount; i++) { @@ -955,11 +963,15 @@ throw new RuntimeException("xlat array for cmap fmt=12"); } - numGroups = buffer.getInt(offset+12); + buffer.position(offset+12); + numGroups = buffer.getInt() & INTMASK; + // A map group record is three uint32's making for 12 bytes total + if (buffer.remaining() < (12 * (long)numGroups)) { + throw new RuntimeException("Format 12 table exceeded"); + } startCharCode = new long[numGroups]; endCharCode = new long[numGroups]; startGlyphID = new int[numGroups]; - buffer.position(offset+16); buffer = buffer.slice(); IntBuffer ibuffer = buffer.asIntBuffer(); for (int i=0; i<numGroups; i++) {
--- a/src/share/classes/sun/font/FileFont.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/font/FileFont.java Wed Oct 23 15:35:04 2019 +0100 @@ -171,7 +171,7 @@ } } if (scaler != null) { - scaler.dispose(); + scaler.disposeScaler(); } scaler = FontScaler.getNullScaler(); }
--- a/src/share/classes/sun/font/FontScaler.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/font/FontScaler.java Wed Oct 23 15:35:04 2019 +0100 @@ -198,6 +198,12 @@ scaler context objects! */ public void dispose() {} + /** + * Used when the native resources held by the scaler need + * to be released before the 2D disposer runs. + */ + public void disposeScaler() {} + /* At the moment these 3 methods are needed for Type1 fonts only. * For Truetype fonts we extract required info outside of scaler * on java layer.
--- a/src/share/classes/sun/font/FreetypeFontScaler.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/font/FreetypeFontScaler.java Wed Oct 23 15:35:04 2019 +0100 @@ -167,6 +167,9 @@ return getLayoutTableCacheNative(nativeScaler); } + /* This method should not be called directly, in case + * it is being invoked from a thread with a native context. + */ public synchronized void dispose() { if (nativeScaler != 0L) { disposeNativeScaler(font.get(), nativeScaler); @@ -174,6 +177,21 @@ } } + public synchronized void disposeScaler() { + if (nativeScaler != 0L) { + /* + * The current thread may be calling this method from the context + * of a JNI up-call. It will hold the native lock from the + * original down-call so can directly enter dispose and free + * the resources. So we need to schedule the disposal to happen + * only once we've returned from native. So by running the dispose + * on another thread which does nothing except that disposal we + * are sure that this is safe. + */ + new Thread(null, () -> dispose(), "free scaler", 0).start(); + } + } + synchronized int getNumGlyphs() throws FontScalerException { if (nativeScaler != 0L) { return getNumGlyphsNative(nativeScaler); @@ -210,7 +228,7 @@ return getUnitsPerEMNative(nativeScaler); } - long createScalerContext(double[] matrix, + synchronized long createScalerContext(double[] matrix, int aa, int fm, float boldness, float italic, boolean disableHinting) { if (nativeScaler != 0L) { @@ -240,7 +258,7 @@ private native GeneralPath getGlyphVectorOutlineNative(Font2D font, long pScalerContext, long pScaler, int[] glyphs, int numGlyphs, float x, float y); - native Point2D.Float getGlyphPointNative(Font2D font, + private native Point2D.Float getGlyphPointNative(Font2D font, long pScalerContext, long pScaler, int glyphCode, int ptNumber); private native long getLayoutTableCacheNative(long pScaler); @@ -253,7 +271,7 @@ private native long getUnitsPerEMNative(long pScaler); - native long createScalerContextNative(long pScaler, double[] matrix, + private native long createScalerContextNative(long pScaler, double[] matrix, int aa, int fm, float boldness, float italic); /* Freetype scaler context does not contain any pointers that
--- a/src/share/classes/sun/font/GlyphList.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/font/GlyphList.java Wed Oct 23 15:35:04 2019 +0100 @@ -323,6 +323,14 @@ */ public void setGlyphIndex(int i) { glyphindex = i; + if (images[i] == 0L) { + metrics[0] = (int)gposx; + metrics[1] = (int)gposy; + metrics[2] = 0; + metrics[3] = 0; + metrics[4] = 0; + return; + } float gx = StrikeCache.unsafe.getFloat(images[i]+StrikeCache.topLeftXOffset); float gy = @@ -361,6 +369,9 @@ graybits = new byte[len]; } } + if (images[glyphindex] == 0L) { + return graybits; + } long pixelDataAddress = StrikeCache.unsafe.getAddress(images[glyphindex] + StrikeCache.pixelDataOffset); @@ -468,6 +479,9 @@ char gw, gh; float gx, gy, gx0, gy0, gx1, gy1; for (int i=0; i<len; i++) { + if (images[i] == 0L) { + continue; + } gx = StrikeCache.unsafe.getFloat(images[i]+xOffset); gy = StrikeCache.unsafe.getFloat(images[i]+yOffset); gw = StrikeCache.unsafe.getChar(images[i]+wOffset);
--- a/src/share/classes/sun/java2d/SunGraphics2D.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/java2d/SunGraphics2D.java Wed Oct 23 15:35:04 2019 +0100 @@ -3018,7 +3018,8 @@ if (data == null) { throw new NullPointerException("char data is null"); } - if (offset < 0 || length < 0 || offset + length > data.length) { + if (offset < 0 || length < 0 || offset + length < length || + offset + length > data.length) { throw new ArrayIndexOutOfBoundsException("bad offset/length"); } if (font.hasLayoutAttributes()) { @@ -3050,7 +3051,8 @@ if (data == null) { throw new NullPointerException("byte data is null"); } - if (offset < 0 || length < 0 || offset + length > data.length) { + if (offset < 0 || length < 0 || offset + length < length || + offset + length > data.length) { throw new ArrayIndexOutOfBoundsException("bad offset/length"); } /* Byte data is interpreted as 8-bit ASCII. Re-use drawChars loops */
--- a/src/share/classes/sun/misc/Launcher.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/misc/Launcher.java Wed Oct 23 15:35:04 2019 +0100 @@ -85,6 +85,9 @@ // Finally, install a security manager if requested String s = System.getProperty("java.security.manager"); if (s != null) { + // init FileSystem machinery before SecurityManager installation + sun.nio.fs.DefaultFileSystemProvider.create(); + SecurityManager sm = null; if ("".equals(s) || "default".equals(s)) { sm = new java.lang.SecurityManager();
--- a/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Wed Oct 23 15:35:04 2019 +0100 @@ -2145,6 +2145,10 @@ } while (retryTunnel < maxRedirects); if (retryTunnel >= maxRedirects || (respCode != HTTP_OK)) { + if (respCode != HTTP_PROXY_AUTH) { + // remove all but authenticate responses + responses.reset(); + } throw new IOException("Unable to tunnel through proxy."+ " Proxy returns \"" + statusLine + "\"");
--- a/src/share/classes/sun/net/www/protocol/jar/Handler.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/net/www/protocol/jar/Handler.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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 @@ -121,6 +121,13 @@ return h; } + public String checkNestedProtocol(String spec) { + if (spec.regionMatches(true, 0, "jar:", 0, 4)) { + return "Nested JAR URLs are not supported"; + } else { + return null; + } + } @Override @SuppressWarnings("deprecation") @@ -147,6 +154,12 @@ } spec = spec.substring(start, limit); + String exceptionMessage = checkNestedProtocol(spec); + if (exceptionMessage != null) { + // NPE will be transformed into MalformedURLException by the caller + throw new NullPointerException(exceptionMessage); + } + if (absoluteSpec) { file = parseAbsoluteSpec(spec); } else if (!refOnly) {
--- a/src/share/classes/sun/rmi/registry/RegistryImpl_Skel.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/rmi/registry/RegistryImpl_Skel.java Wed Oct 23 15:35:04 2019 +0100 @@ -27,13 +27,8 @@ package sun.rmi.registry; import java.io.IOException; -import java.io.InputStream; -import java.rmi.AccessException; -import java.rmi.server.RemoteCall; -import sun.rmi.transport.Connection; import sun.rmi.transport.StreamRemoteCall; -import sun.rmi.transport.tcp.TCPConnection; /** * Skeleton to dispatch RegistryImpl methods. @@ -56,7 +51,7 @@ return operations.clone(); } - public void dispatch(java.rmi.Remote obj, java.rmi.server.RemoteCall call, int opnum, long hash) + public void dispatch(java.rmi.Remote obj, java.rmi.server.RemoteCall remoteCall, int opnum, long hash) throws java.lang.Exception { if (opnum < 0) { if (hash == 7583982177005850366L) { @@ -78,6 +73,7 @@ } sun.rmi.registry.RegistryImpl server = (sun.rmi.registry.RegistryImpl) obj; + StreamRemoteCall call = (StreamRemoteCall) remoteCall; switch (opnum) { case 0: // bind(String, Remote) { @@ -90,7 +86,8 @@ java.io.ObjectInput in = call.getInputStream(); $param_String_1 = (java.lang.String) in.readObject(); $param_Remote_2 = (java.rmi.Remote) in.readObject(); - } catch (java.io.IOException | java.lang.ClassNotFoundException e) { + } catch (ClassCastException | IOException | ClassNotFoundException e) { + call.discardPendingRefs(); throw new java.rmi.UnmarshalException("error unmarshalling arguments", e); } finally { call.releaseInputStream(); @@ -123,7 +120,8 @@ try { java.io.ObjectInput in = call.getInputStream(); $param_String_1 = (java.lang.String) in.readObject(); - } catch (java.io.IOException | java.lang.ClassNotFoundException e) { + } catch (ClassCastException | IOException | ClassNotFoundException e) { + call.discardPendingRefs(); throw new java.rmi.UnmarshalException("error unmarshalling arguments", e); } finally { call.releaseInputStream(); @@ -149,7 +147,8 @@ java.io.ObjectInput in = call.getInputStream(); $param_String_1 = (java.lang.String) in.readObject(); $param_Remote_2 = (java.rmi.Remote) in.readObject(); - } catch (java.io.IOException | java.lang.ClassNotFoundException e) { + } catch (ClassCastException | IOException | java.lang.ClassNotFoundException e) { + call.discardPendingRefs(); throw new java.rmi.UnmarshalException("error unmarshalling arguments", e); } finally { call.releaseInputStream(); @@ -172,7 +171,8 @@ try { java.io.ObjectInput in = call.getInputStream(); $param_String_1 = (java.lang.String) in.readObject(); - } catch (java.io.IOException | java.lang.ClassNotFoundException e) { + } catch (ClassCastException | IOException | ClassNotFoundException e) { + call.discardPendingRefs(); throw new java.rmi.UnmarshalException("error unmarshalling arguments", e); } finally { call.releaseInputStream();
--- a/src/share/classes/sun/rmi/registry/RegistryImpl_Stub.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/rmi/registry/RegistryImpl_Stub.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, 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 @@ -24,6 +24,11 @@ */ package sun.rmi.registry; + +import java.io.IOException; + +import sun.rmi.transport.StreamRemoteCall; + /** * Stubs to invoke RegistryImpl remote methods. * Originally generated from RMIC but frozen to match RegistryImpl_Skel. @@ -57,7 +62,7 @@ public void bind(java.lang.String $param_String_1, java.rmi.Remote $param_Remote_2) throws java.rmi.AccessException, java.rmi.AlreadyBoundException, java.rmi.RemoteException { try { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash); + StreamRemoteCall call = (StreamRemoteCall)ref.newCall(this, operations, 0, interfaceHash); try { java.io.ObjectOutput out = call.getOutputStream(); out.writeObject($param_String_1); @@ -82,15 +87,14 @@ public java.lang.String[] list() throws java.rmi.AccessException, java.rmi.RemoteException { try { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash); + StreamRemoteCall call = (StreamRemoteCall)ref.newCall(this, operations, 1, interfaceHash); ref.invoke(call); java.lang.String[] $result; try { java.io.ObjectInput in = call.getInputStream(); $result = (java.lang.String[]) in.readObject(); - } catch (java.io.IOException e) { - throw new java.rmi.UnmarshalException("error unmarshalling return", e); - } catch (java.lang.ClassNotFoundException e) { + } catch (ClassCastException | IOException | ClassNotFoundException e) { + call.discardPendingRefs(); throw new java.rmi.UnmarshalException("error unmarshalling return", e); } finally { ref.done(call); @@ -109,7 +113,7 @@ public java.rmi.Remote lookup(java.lang.String $param_String_1) throws java.rmi.AccessException, java.rmi.NotBoundException, java.rmi.RemoteException { try { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 2, interfaceHash); + StreamRemoteCall call = (StreamRemoteCall)ref.newCall(this, operations, 2, interfaceHash); try { java.io.ObjectOutput out = call.getOutputStream(); out.writeObject($param_String_1); @@ -121,9 +125,8 @@ try { java.io.ObjectInput in = call.getInputStream(); $result = (java.rmi.Remote) in.readObject(); - } catch (java.io.IOException e) { - throw new java.rmi.UnmarshalException("error unmarshalling return", e); - } catch (java.lang.ClassNotFoundException e) { + } catch (ClassCastException | IOException | ClassNotFoundException e) { + call.discardPendingRefs(); throw new java.rmi.UnmarshalException("error unmarshalling return", e); } finally { ref.done(call); @@ -144,7 +147,7 @@ public void rebind(java.lang.String $param_String_1, java.rmi.Remote $param_Remote_2) throws java.rmi.AccessException, java.rmi.RemoteException { try { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 3, interfaceHash); + StreamRemoteCall call = (StreamRemoteCall)ref.newCall(this, operations, 3, interfaceHash); try { java.io.ObjectOutput out = call.getOutputStream(); out.writeObject($param_String_1); @@ -167,7 +170,7 @@ public void unbind(java.lang.String $param_String_1) throws java.rmi.AccessException, java.rmi.NotBoundException, java.rmi.RemoteException { try { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 4, interfaceHash); + StreamRemoteCall call = (StreamRemoteCall)ref.newCall(this, operations, 4, interfaceHash); try { java.io.ObjectOutput out = call.getOutputStream(); out.writeObject($param_String_1);
--- a/src/share/classes/sun/rmi/transport/DGCImpl_Skel.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/rmi/transport/DGCImpl_Skel.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, 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 @@ -25,6 +25,8 @@ package sun.rmi.transport; +import java.io.IOException; + /** * Skeleton to dispatch DGC methods. * Originally generated by RMIC but frozen to match the stubs. @@ -43,12 +45,13 @@ return operations.clone(); } - public void dispatch(java.rmi.Remote obj, java.rmi.server.RemoteCall call, int opnum, long hash) + public void dispatch(java.rmi.Remote obj, java.rmi.server.RemoteCall remoteCall, int opnum, long hash) throws java.lang.Exception { if (hash != interfaceHash) throw new java.rmi.server.SkeletonMismatchException("interface hash mismatch"); sun.rmi.transport.DGCImpl server = (sun.rmi.transport.DGCImpl) obj; + StreamRemoteCall call = (StreamRemoteCall) remoteCall; switch (opnum) { case 0: // clean(ObjID[], long, VMID, boolean) { @@ -62,9 +65,8 @@ $param_long_2 = in.readLong(); $param_VMID_3 = (java.rmi.dgc.VMID) in.readObject(); $param_boolean_4 = in.readBoolean(); - } catch (java.io.IOException e) { - throw new java.rmi.UnmarshalException("error unmarshalling arguments", e); - } catch (java.lang.ClassNotFoundException e) { + } catch (ClassCastException | IOException | ClassNotFoundException e) { + call.discardPendingRefs(); throw new java.rmi.UnmarshalException("error unmarshalling arguments", e); } finally { call.releaseInputStream(); @@ -88,9 +90,8 @@ $param_arrayOf_ObjID_1 = (java.rmi.server.ObjID[]) in.readObject(); $param_long_2 = in.readLong(); $param_Lease_3 = (java.rmi.dgc.Lease) in.readObject(); - } catch (java.io.IOException e) { - throw new java.rmi.UnmarshalException("error unmarshalling arguments", e); - } catch (java.lang.ClassNotFoundException e) { + } catch (ClassCastException | IOException | ClassNotFoundException e) { + call.discardPendingRefs(); throw new java.rmi.UnmarshalException("error unmarshalling arguments", e); } finally { call.releaseInputStream();
--- a/src/share/classes/sun/rmi/transport/DGCImpl_Stub.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/rmi/transport/DGCImpl_Stub.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, 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 @@ -25,16 +25,15 @@ package sun.rmi.transport; -import java.io.ObjectInputStream; +import sun.rmi.transport.tcp.TCPConnection; + +import java.io.IOException; import java.rmi.dgc.Lease; import java.rmi.dgc.VMID; import java.rmi.server.UID; -import java.security.AccessController; -import java.security.PrivilegedAction; +import java.util.ArrayList; import sun.misc.ObjectInputFilter; -import sun.rmi.server.UnicastRef; -import sun.rmi.transport.tcp.TCPConnection; /** * Stubs to invoke DGC remote methods. @@ -72,7 +71,9 @@ public void clean(java.rmi.server.ObjID[] $param_arrayOf_ObjID_1, long $param_long_2, java.rmi.dgc.VMID $param_VMID_3, boolean $param_boolean_4) throws java.rmi.RemoteException { try { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash); + StreamRemoteCall call = (StreamRemoteCall)ref.newCall((java.rmi.server.RemoteObject) this, + operations, 0, interfaceHash); + call.setObjectInputFilter(DGCImpl_Stub::leaseFilter); try { java.io.ObjectOutput out = call.getOutputStream(); out.writeObject($param_arrayOf_ObjID_1); @@ -97,7 +98,10 @@ public java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[] $param_arrayOf_ObjID_1, long $param_long_2, java.rmi.dgc.Lease $param_Lease_3) throws java.rmi.RemoteException { try { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash); + StreamRemoteCall call = + (StreamRemoteCall)ref.newCall((java.rmi.server.RemoteObject) this, + operations, 1, interfaceHash); + call.setObjectInputFilter(DGCImpl_Stub::leaseFilter); try { java.io.ObjectOutput out = call.getOutputStream(); out.writeObject($param_arrayOf_ObjID_1); @@ -108,26 +112,17 @@ } ref.invoke(call); java.rmi.dgc.Lease $result; - Connection connection = ((StreamRemoteCall) call).getConnection(); + Connection connection = call.getConnection(); try { java.io.ObjectInput in = call.getInputStream(); - if (in instanceof ObjectInputStream) { - /** - * Set a filter on the stream for the return value. - */ - ObjectInputStream ois = (ObjectInputStream) in; - AccessController.doPrivileged((PrivilegedAction<Void>)() -> { - ObjectInputFilter.Config.setObjectInputFilter(ois, DGCImpl_Stub::leaseFilter); - return null; - }); - } $result = (java.rmi.dgc.Lease) in.readObject(); - } catch (java.io.IOException | java.lang.ClassNotFoundException e) { + } catch (ClassCastException | IOException | ClassNotFoundException e) { if (connection instanceof TCPConnection) { // Modified to prevent re-use of the connection after an exception ((TCPConnection) connection).getChannel().free(connection, false); } + call.discardPendingRefs(); throw new java.rmi.UnmarshalException("error unmarshalling return", e); } finally { ref.done(call); @@ -146,6 +141,10 @@ * ObjectInputFilter to filter DGCClient return value (a Lease). * The list of acceptable classes is very short and explicit. * The depth and array sizes are limited. + * <p> + * The filter must accept normal and exception returns. + * A DGC server may throw exceptions that may have a cause + * and suppressed exceptions. * * @param filterInfo access to class, arrayLength, etc. * @return {@link ObjectInputFilter.Status#ALLOWED} if allowed, @@ -172,7 +171,16 @@ } return (clazz == UID.class || clazz == VMID.class || - clazz == Lease.class) + clazz == Lease.class || + (Throwable.class.isAssignableFrom(clazz) && + clazz.getClassLoader() == + Object.class.getClassLoader()) || + clazz == StackTraceElement.class || + clazz == ArrayList.class || // for suppressed exceptions, if any + clazz == Object.class || + clazz.getName().equals("java.util.Collections$UnmodifiableList") || + clazz.getName().equals("java.util.Collections$UnmodifiableCollection") || + clazz.getName().equals("java.util.Collections$UnmodifiableRandomAccessList")) ? ObjectInputFilter.Status.ALLOWED : ObjectInputFilter.Status.REJECTED; }
--- a/src/share/classes/sun/rmi/transport/StreamRemoteCall.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/rmi/transport/StreamRemoteCall.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2019, 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 @@ -36,6 +36,10 @@ import java.rmi.UnmarshalException; import java.rmi.server.ObjID; import java.rmi.server.RemoteCall; +import java.security.AccessController; +import java.security.PrivilegedAction; + +import sun.misc.ObjectInputFilter; import sun.rmi.runtime.Log; import sun.rmi.server.UnicastRef; import sun.rmi.transport.tcp.TCPEndpoint; @@ -50,6 +54,7 @@ private ConnectionInputStream in = null; private ConnectionOutputStream out = null; private Connection conn; + private ObjectInputFilter filter = null; private boolean resultStarted = false; private Exception serverException = null; @@ -123,6 +128,13 @@ } } + public void setObjectInputFilter(ObjectInputFilter filter) { + if (in != null) { + throw new IllegalStateException("set filter must occur before calling getInputStream"); + } + this.filter = filter; + } + /** * Get the InputStream the stub/skeleton should get results/arguments * from. @@ -132,6 +144,12 @@ Transport.transportLog.log(Log.VERBOSE, "getting input stream"); in = new ConnectionInputStream(conn.getInputStream()); + if (filter != null) { + AccessController.doPrivileged((PrivilegedAction<Void>) () -> { + ObjectInputFilter.Config.setObjectInputFilter(in, filter); + return null; + }); + } } return in; } @@ -251,6 +269,7 @@ try { ex = in.readObject(); } catch (Exception e) { + discardPendingRefs(); throw new UnmarshalException("Error unmarshaling return", e); } @@ -259,6 +278,7 @@ if (ex instanceof Exception) { exceptionReceivedFromServer((Exception) ex); } else { + discardPendingRefs(); throw new UnmarshalException("Return type not Exception"); } // Exception is thrown before fallthrough can occur
--- a/src/share/classes/sun/security/ec/ECDSASignature.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/security/ec/ECDSASignature.java Wed Oct 23 15:35:04 2019 +0100 @@ -329,10 +329,10 @@ // DER OID byte[] encodedParams = ECUtil.encodeECParameterSpec(null, params); - int keySize = params.getCurve().getField().getFieldSize(); + int orderLength = params.getOrder().bitLength(); - // seed is twice the key size (in bytes) plus 1 - byte[] seed = new byte[(((keySize + 7) >> 3) + 1) * 2]; + // seed is twice the order length (in bytes) plus 1 + byte[] seed = new byte[(((orderLength + 7) >> 3) + 1) * 2]; random.nextBytes(seed);
--- a/src/share/classes/sun/security/jgss/krb5/Krb5Context.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/security/jgss/krb5/Krb5Context.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -614,6 +614,8 @@ if (myCred == null) { myCred = Krb5InitCredential.getInstance(caller, myName, GSSCredential.DEFAULT_LIFETIME); + myCred = Krb5ProxyCredential.tryImpersonation( + caller, (Krb5InitCredential)myCred); } else if (!myCred.isInitiatorCredential()) { throw new GSSException(errorCode, -1, "No TGT available"); @@ -651,8 +653,8 @@ // highly consider just calling: // Subject.getSubject // SubjectComber.find - // instead of Krb5Util.getTicket - return Krb5Util.getTicket( + // instead of Krb5Util.getServiceTicket + return Krb5Util.getServiceTicket( GSSCaller.CALLER_UNKNOWN, // since it's useSubjectCredsOnly here, // don't worry about the null
--- a/src/share/classes/sun/security/jgss/krb5/Krb5InitCredential.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/security/jgss/krb5/Krb5InitCredential.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -55,6 +55,7 @@ private Krb5NameElement name; private Credentials krb5Credentials; + public KerberosTicket proxyTicket; private Krb5InitCredential(Krb5NameElement name, byte[] asn1Encoding, @@ -153,7 +154,7 @@ Krb5MechFactory.NT_GSS_KRB5_PRINCIPAL); } - return new Krb5InitCredential(name, + Krb5InitCredential result = new Krb5InitCredential(name, tgt.getEncoded(), tgt.getClient(), tgt.getServer(), @@ -165,6 +166,9 @@ tgt.getEndTime(), tgt.getRenewTill(), tgt.getClientAddresses()); + result.proxyTicket = KerberosSecrets.getJavaxSecurityAuthKerberosAccess(). + kerberosTicketGetProxy(tgt); + return result; } static Krb5InitCredential getInstance(Krb5NameElement name, @@ -334,9 +338,9 @@ public KerberosTicket run() throws Exception { // It's OK to use null as serverPrincipal. TGT is almost // the first ticket for a principal and we use list. - return Krb5Util.getTicket( + return Krb5Util.getInitialTicket( realCaller, - clientPrincipal, null, acc); + clientPrincipal, acc); }}); } catch (PrivilegedActionException e) { GSSException ge =
--- a/src/share/classes/sun/security/jgss/krb5/Krb5MechFactory.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/security/jgss/krb5/Krb5MechFactory.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -120,6 +120,8 @@ usage == GSSCredential.INITIATE_AND_ACCEPT) { credElement = Krb5InitCredential.getInstance (caller, (Krb5NameElement) name, initLifetime); + credElement = Krb5ProxyCredential.tryImpersonation( + caller, (Krb5InitCredential)credElement); checkInitCredPermission ((Krb5NameElement) credElement.getName()); } else if (usage == GSSCredential.ACCEPT_ONLY) {
--- a/src/share/classes/sun/security/jgss/krb5/Krb5NameElement.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/security/jgss/krb5/Krb5NameElement.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -144,7 +144,7 @@ return new Krb5NameElement(principalName, gssNameStr, gssNameType); } - static Krb5NameElement getInstance(PrincipalName principalName) { + public static Krb5NameElement getInstance(PrincipalName principalName) { return new Krb5NameElement(principalName, principalName.getName(), Krb5MechFactory.NT_GSS_KRB5_PRINCIPAL);
--- a/src/share/classes/sun/security/jgss/krb5/Krb5ProxyCredential.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/security/jgss/krb5/Krb5ProxyCredential.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2019, 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 @@ -26,10 +26,17 @@ package sun.security.jgss.krb5; import org.ietf.jgss.*; +import sun.security.jgss.GSSCaller; import sun.security.jgss.spi.*; -import java.util.Date; + +import java.io.IOException; + +import sun.security.krb5.Credentials; +import sun.security.krb5.KrbException; import sun.security.krb5.internal.Ticket; +import javax.security.auth.kerberos.KerberosTicket; + /** * Implements the krb5 proxy credential element used in constrained * delegation. It is used in both impersonation (where there is no Kerberos 5 @@ -112,4 +119,24 @@ throw new GSSException(GSSException.FAILURE, -1, "Only an initiate credentials can impersonate"); } + + // Try to see if a default credential should act as an impersonator. + static Krb5CredElement tryImpersonation(GSSCaller caller, + Krb5InitCredential initiator) throws GSSException { + + try { + KerberosTicket proxy = initiator.proxyTicket; + if (proxy != null) { + Credentials proxyCreds = Krb5Util.ticketToCreds(proxy); + return new Krb5ProxyCredential(initiator, + Krb5NameElement.getInstance(proxyCreds.getClient()), + proxyCreds.getTicket()); + } else { + return initiator; + } + } catch (KrbException | IOException e) { + throw new GSSException(GSSException.DEFECTIVE_CREDENTIAL, -1, + "Cannot create proxy credential"); + } + } }
--- a/src/share/classes/sun/security/jgss/krb5/Krb5Util.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/security/jgss/krb5/Krb5Util.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, 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 @@ -139,11 +139,8 @@ /** * Retrieves the ticket corresponding to the client/server principal * pair from the Subject in the specified AccessControlContext. - * If the ticket can not be found in the Subject, and if - * useSubjectCredsOnly is false, then obtain ticket from - * a LoginContext. */ - static KerberosTicket getTicket(GSSCaller caller, + static KerberosTicket getServiceTicket(GSSCaller caller, String clientPrincipal, String serverPrincipal, AccessControlContext acc) throws LoginException { @@ -153,11 +150,31 @@ SubjectComber.find(accSubj, serverPrincipal, clientPrincipal, KerberosTicket.class); + return ticket; + } + + /** + * Retrieves the initial TGT corresponding to the client principal + * from the Subject in the specified AccessControlContext. + * If the ticket can not be found in the Subject, and if + * useSubjectCredsOnly is false, then obtain ticket from + * a LoginContext. + */ + static KerberosTicket getInitialTicket(GSSCaller caller, + String clientPrincipal, + AccessControlContext acc) throws LoginException { + + // Try to get ticket from acc's Subject + Subject accSubj = Subject.getSubject(acc); + KerberosTicket ticket = + SubjectComber.find(accSubj, null, clientPrincipal, + KerberosTicket.class); + // Try to get ticket from Subject obtained from GSSUtil if (ticket == null && !GSSUtil.useSubjectCredsOnly(caller)) { Subject subject = GSSUtil.login(caller, GSSUtil.GSS_KRB5_MECH_OID); ticket = SubjectComber.find(subject, - serverPrincipal, clientPrincipal, KerberosTicket.class); + null, clientPrincipal, KerberosTicket.class); } return ticket; }
--- a/src/share/classes/sun/security/krb5/Credentials.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/security/krb5/Credentials.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -56,13 +56,23 @@ KerberosTime endTime; KerberosTime renewTill; HostAddresses cAddr; - EncryptionKey serviceKey; AuthorizationData authzData; private static boolean DEBUG = Krb5.DEBUG; private static CredentialsCache cache; static boolean alreadyLoaded = false; private static boolean alreadyTried = false; + private Credentials proxy = null; + + public Credentials getProxy() { + return proxy; + } + + public Credentials setProxy(Credentials proxy) { + this.proxy = proxy; + return this; + } + // Read native ticket with session key type in the given list private static native Credentials acquireDefaultNativeCreds(int[] eTypes); @@ -336,20 +346,19 @@ return null; } - sun.security.krb5.internal.ccache.Credentials tgtCred = - ccache.getDefaultCreds(); + Credentials tgtCred = ccache.getInitialCreds(); if (tgtCred == null) { return null; } - if (EType.isSupported(tgtCred.getEType())) { - return tgtCred.setKrbCreds(); + if (EType.isSupported(tgtCred.key.getEType())) { + return tgtCred; } else { if (DEBUG) { System.out.println( ">>> unsupported key type found the default TGT: " + - tgtCred.getEType()); + tgtCred.key.getEType()); } return null; } @@ -384,20 +393,19 @@ cache = CredentialsCache.getInstance(); } if (cache != null) { - sun.security.krb5.internal.ccache.Credentials temp = - cache.getDefaultCreds(); + Credentials temp = cache.getInitialCreds(); if (temp != null) { if (DEBUG) { System.out.println(">>> KrbCreds found the default ticket" + " granting ticket in credential cache."); } - if (EType.isSupported(temp.getEType())) { - result = temp.setKrbCreds(); + if (EType.isSupported(temp.key.getEType())) { + result = temp; } else { if (DEBUG) { System.out.println( ">>> unsupported key type found the default TGT: " + - temp.getEType()); + temp.key.getEType()); } } } @@ -474,10 +482,6 @@ return cache; } - public EncryptionKey getServiceKey() { - return serviceKey; - } - /* * Prints out debug info. */
--- a/src/share/classes/sun/security/krb5/JavaxSecurityAuthKerberosAccess.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/security/krb5/JavaxSecurityAuthKerberosAccess.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2019, 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 @@ -25,9 +25,8 @@ package sun.security.krb5; +import javax.security.auth.kerberos.KerberosTicket; import javax.security.auth.kerberos.KeyTab; -import sun.security.krb5.EncryptionKey; -import sun.security.krb5.PrincipalName; /** * An unsafe tunnel to get non-public access to classes in the @@ -39,4 +38,14 @@ */ public sun.security.krb5.internal.ktab.KeyTab keyTabTakeSnapshot( KeyTab ktab); + + /** + * Returns the proxy for a KerberosTicket. + */ + public KerberosTicket kerberosTicketGetProxy(KerberosTicket t); + + /** + * Sets the proxy for a KerberosTicket. + */ + public void kerberosTicketSetProxy(KerberosTicket t, KerberosTicket p); }
--- a/src/share/classes/sun/security/krb5/Realm.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/security/krb5/Realm.java Wed Oct 23 15:35:04 2019 +0100 @@ -188,7 +188,6 @@ return false; for (int i = 0; i < name.length(); i++) { if (name.charAt(i) == '/' || - name.charAt(i) == ':' || name.charAt(i) == '\0') { return false; }
--- a/src/share/classes/sun/security/krb5/internal/ccache/CCacheInputStream.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/security/krb5/internal/ccache/CCacheInputStream.java Wed Oct 23 15:35:04 2019 +0100 @@ -325,16 +325,13 @@ } /** - * Reads the next cred in stream. - * @return the next cred, null if ticket or second_ticket unparseable. + * Reads the next cred or config entry in stream. + * @return the next cred or config entry, null if data unparseable. * - * Note: MIT krb5 1.8.1 might generate a config entry with server principal - * X-CACHECONF:/krb5_ccache_conf_data/fast_avail/krbtgt/REALM@REALM. The - * entry is used by KDC to inform the client that it support certain - * features. Its ticket is not a valid krb5 ticket and thus this method - * returns null. + * When data is unparseable, this method makes sure the correct number of + * bytes are consumed so it's safe to start reading the next element. */ - Credentials readCred(int version) throws IOException,RealmException, KrbApErrException, Asn1Exception { + Object readCred(int version) throws IOException,RealmException, KrbApErrException, Asn1Exception { PrincipalName cpname = null; try { cpname = readPrincipal(version); @@ -396,12 +393,23 @@ } try { + if (spname.getRealmString().equals("X-CACHECONF:")) { + String[] nameParts = spname.getNameStrings(); + if (nameParts[0].equals("krb5_ccache_conf_data")) { + return new CredentialsCache.ConfigEntry(nameParts[1], + nameParts.length > 2 ? new PrincipalName(nameParts[2]) : null, + ticketData); + } + } return new Credentials(cpname, spname, key, authtime, starttime, - endtime, renewTill, skey, tFlags, - addrs, auData, - ticketData != null ? new Ticket(ticketData) : null, - ticketData2 != null ? new Ticket(ticketData2) : null); + endtime, renewTill, skey, tFlags, + addrs, auData, + ticketData != null ? new Ticket(ticketData) : null, + ticketData2 != null ? new Ticket(ticketData2) : null); } catch (Exception e) { // If any of new Ticket(*) fails. + if (DEBUG) { + e.printStackTrace(System.out); + } return null; } }
--- a/src/share/classes/sun/security/krb5/internal/ccache/CCacheOutputStream.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/security/krb5/internal/ccache/CCacheOutputStream.java Wed Oct 23 15:35:04 2019 +0100 @@ -31,7 +31,6 @@ package sun.security.krb5.internal.ccache; import java.io.IOException; -import java.io.FileOutputStream; import java.io.OutputStream; import sun.security.krb5.internal.util.KrbDataOutputStream; import sun.security.krb5.*; @@ -98,6 +97,21 @@ writeTicket(creds.secondTicket); } + public void addConfigEntry(PrincipalName cname, CredentialsCache.ConfigEntry e) + throws IOException { + cname.writePrincipal(this); + e.getSName().writePrincipal(this); + write16(0); write16(0); write32(0); + write32(0); write32(0); write32(0); write32(0); + write8(0); + write32(0); + write32(0); + write32(0); + write32(e.getData().length); + write(e.getData()); + write32(0); + } + void writeTicket(Ticket t) throws IOException, Asn1Exception { if (t == null) { write32(0);
--- a/src/share/classes/sun/security/krb5/internal/ccache/Credentials.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/security/krb5/internal/ccache/Credentials.java Wed Oct 23 15:35:04 2019 +0100 @@ -169,6 +169,18 @@ return sname; } + public Ticket getTicket() throws RealmException { + return ticket; + } + + public PrincipalName getServicePrincipal2() throws RealmException { + return secondTicket == null ? null : secondTicket.sname; + } + + public PrincipalName getClientPrincipal() throws RealmException { + return cname; + } + public sun.security.krb5.Credentials setKrbCreds() { // Note: We will not pass authorizationData to s.s.k.Credentials. The // field in that class will be passed to Krb5Context as the return @@ -208,7 +220,15 @@ return key.getEType(); } + public EncryptionKey getKey() { + return key; + } + public int getTktEType() { return ticket.encPart.getEType(); } + + public int getTktEType2() { + return (secondTicket == null) ? 0 : secondTicket.encPart.getEType(); + } }
--- a/src/share/classes/sun/security/krb5/internal/ccache/CredentialsCache.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/security/krb5/internal/ccache/CredentialsCache.java Wed Oct 23 15:35:04 2019 +0100 @@ -32,14 +32,9 @@ import sun.security.krb5.*; import sun.security.krb5.internal.*; -import java.util.StringTokenizer; -import java.util.Vector; + +import java.util.List; import java.io.IOException; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.BufferedReader; -import java.io.InputStreamReader; /** * CredentialsCache stores credentials(tickets, session keys, etc) in a semi-permanent store @@ -120,6 +115,62 @@ public abstract void save() throws IOException, KrbException; public abstract Credentials[] getCredsList(); public abstract Credentials getDefaultCreds(); + public abstract sun.security.krb5.Credentials getInitialCreds(); public abstract Credentials getCreds(PrincipalName sname); public abstract Credentials getCreds(LoginOptions options, PrincipalName sname); + public abstract void addConfigEntry(ConfigEntry e); + public abstract List<ConfigEntry> getConfigEntries(); + + public ConfigEntry getConfigEntry(String name) { + List<ConfigEntry> entries = getConfigEntries(); + if (entries != null) { + for (ConfigEntry e : entries) { + if (e.getName().equals(name)) { + return e; + } + } + } + return null; + } + + public static class ConfigEntry { + + public ConfigEntry(String name, PrincipalName princ, byte[] data) { + this.name = name; + this.princ = princ; + this.data = data; + } + + private final String name; + private final PrincipalName princ; + private final byte[] data; // not worth cloning + + public String getName() { + return name; + } + + public PrincipalName getPrinc() { + return princ; + } + + public byte[] getData() { + return data; + } + + @Override + public String toString() { + return name + (princ != null ? ("." + princ) : "") + + ": " + new String(data); + } + + public PrincipalName getSName() { + try { + return new PrincipalName("krb5_ccache_conf_data/" + name + + (princ != null ? ("/" + princ) : "") + + "@X-CACHECONF:"); + } catch (RealmException e) { + throw new AssertionError(e); + } + } + } }
--- a/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013 Red Hat, Inc. and/or its affiliates. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -36,6 +36,12 @@ import sun.security.krb5.*; import sun.security.krb5.internal.*; +import sun.security.util.SecurityProperties; + +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import java.util.StringTokenizer; import java.util.Vector; import java.io.IOException; @@ -187,9 +193,13 @@ primaryPrincipal = p; credentialsList = new Vector<Credentials>(); while (cis.available() > 0) { - Credentials cred = cis.readCred(version); + Object cred = cis.readCred(version); if (cred != null) { - credentialsList.addElement(cred); + if (cred instanceof Credentials) { + credentialsList.addElement((Credentials)cred); + } else { + addConfigEntry((CredentialsCache.ConfigEntry)cred); + } } } } @@ -260,6 +270,9 @@ cos.addCreds(tmp[i]); } } + for (ConfigEntry e : getConfigEntries()) { + cos.addConfigEntry(primaryPrincipal, e); + } } } @@ -312,6 +325,17 @@ } } + private List<ConfigEntry> configEntries = new ArrayList<>(); + + @Override + public void addConfigEntry(ConfigEntry e) { + configEntries.add(e); + } + + @Override + public List<ConfigEntry> getConfigEntries() { + return Collections.unmodifiableList(configEntries); + } /** * Gets a credentials for a specified service. @@ -331,6 +355,81 @@ return null; } + public sun.security.krb5.Credentials getInitialCreds() { + + Credentials defaultCreds = getDefaultCreds(); + if (defaultCreds == null) { + return null; + } + sun.security.krb5.Credentials tgt = defaultCreds.setKrbCreds(); + + CredentialsCache.ConfigEntry entry = getConfigEntry("proxy_impersonator"); + if (entry == null) { + if (DEBUG) { + System.out.println("get normal credential"); + } + return tgt; + } + + boolean force; + String prop = SecurityProperties.privilegedGetOverridable( + "jdk.security.krb5.default.initiate.credential"); + if (prop == null) { + prop = "always-impersonate"; + } + switch (prop) { + case "no-impersonate": // never try impersonation + if (DEBUG) { + System.out.println("get normal credential"); + } + return tgt; + case "try-impersonate": + force = false; + break; + case "always-impersonate": + force = true; + break; + default: + throw new RuntimeException( + "Invalid jdk.security.krb5.default.initiate.credential"); + } + + try { + PrincipalName service = new PrincipalName( + new String(entry.getData(), StandardCharsets.UTF_8)); + if (!tgt.getClient().equals(service)) { + if (DEBUG) { + System.out.println("proxy_impersonator does not match service name"); + } + return force ? null : tgt; + } + PrincipalName client = getPrimaryPrincipal(); + Credentials proxy = null; + for (Credentials c : getCredsList()) { + if (c.getClientPrincipal().equals(client) + && c.getServicePrincipal().equals(service)) { + proxy = c; + break; + } + } + if (proxy == null) { + if (DEBUG) { + System.out.println("Cannot find evidence ticket in ccache"); + } + return force ? null : tgt; + } + if (DEBUG) { + System.out.println("Get proxied credential"); + } + return tgt.setProxy(proxy.setKrbCreds()); + } catch (KrbException e) { + if (DEBUG) { + System.out.println("Impersonation with ccache failed"); + } + return force ? null : tgt; + } + } + public Credentials getDefaultCreds() { Credentials[] list = getCredsList(); if (list == null) {
--- a/src/share/classes/sun/security/pkcs11/P11Key.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/security/pkcs11/P11Key.java Wed Oct 23 15:35:04 2019 +0100 @@ -1129,20 +1129,79 @@ private static long nativeKeyWrapperKeyID = 0; private static CK_MECHANISM nativeKeyWrapperMechanism = null; + private static long nativeKeyWrapperRefCount = 0; + private static Session nativeKeyWrapperSession = null; private final P11Key p11Key; private final byte[] nativeKeyInfo; + private boolean wrapperKeyUsed; // destroyed and recreated when refCount toggles to 1 private long keyID; - private boolean isTokenObject; - // phantom reference notification clean up for session keys private SessionKeyRef ref; private int refCount; + private static void createNativeKeyWrapper(Token token) + throws PKCS11Exception { + assert(nativeKeyWrapperKeyID == 0); + assert(nativeKeyWrapperRefCount == 0); + assert(nativeKeyWrapperSession == null); + // Create a global wrapping/unwrapping key + CK_ATTRIBUTE[] wrappingAttributes = token.getAttributes(O_GENERATE, + CKO_SECRET_KEY, CKK_AES, new CK_ATTRIBUTE[] { + new CK_ATTRIBUTE(CKA_CLASS, CKO_SECRET_KEY), + new CK_ATTRIBUTE(CKA_VALUE_LEN, 256 >> 3)}); + Session s = null; + try { + s = token.getObjSession(); + nativeKeyWrapperKeyID = token.p11.C_GenerateKey( + s.id(), new CK_MECHANISM(CKM_AES_KEY_GEN), + wrappingAttributes); + nativeKeyWrapperSession = s; + nativeKeyWrapperSession.addObject(); + byte[] iv = new byte[16]; + JCAUtil.getSecureRandom().nextBytes(iv); + nativeKeyWrapperMechanism = new CK_MECHANISM(CKM_AES_CBC_PAD, iv); + } catch (PKCS11Exception e) { + // best effort + } finally { + token.releaseSession(s); + } + } + + private static void deleteNativeKeyWrapper() { + Token token = nativeKeyWrapperSession.token; + if (token.isValid()) { + Session s = null; + try { + s = token.getOpSession(); + token.p11.C_DestroyObject(s.id(), nativeKeyWrapperKeyID); + nativeKeyWrapperSession.removeObject(); + } catch (PKCS11Exception e) { + // best effort + } finally { + token.releaseSession(s); + } + } + nativeKeyWrapperKeyID = 0; + nativeKeyWrapperMechanism = null; + nativeKeyWrapperSession = null; + } + + static void decWrapperKeyRef() { + synchronized(NativeKeyHolder.class) { + assert(nativeKeyWrapperKeyID != 0); + assert(nativeKeyWrapperRefCount > 0); + nativeKeyWrapperRefCount--; + if (nativeKeyWrapperRefCount == 0) { + deleteNativeKeyWrapper(); + } + } + } + NativeKeyHolder(P11Key p11Key, long keyID, Session keySession, boolean extractKeyInfo, boolean isTokenObject) { this.p11Key = p11Key; @@ -1152,35 +1211,23 @@ if (isTokenObject) { this.ref = null; } else { - this.ref = new SessionKeyRef(p11Key, keyID, keySession); - // Try extracting key info, if any error, disable it Token token = p11Key.token; if (extractKeyInfo) { try { - if (p11Key.sensitive && nativeKeyWrapperKeyID == 0) { + if (p11Key.sensitive) { + // p11Key native key information has to be wrapped synchronized(NativeKeyHolder.class) { - // Create a global wrapping/unwrapping key - CK_ATTRIBUTE[] wrappingAttributes = token.getAttributes - (O_GENERATE, CKO_SECRET_KEY, CKK_AES, new CK_ATTRIBUTE[] { - new CK_ATTRIBUTE(CKA_CLASS, CKO_SECRET_KEY), - new CK_ATTRIBUTE(CKA_VALUE_LEN, 256 >> 3), - }); - Session wrappingSession = null; - try { - wrappingSession = token.getObjSession(); - nativeKeyWrapperKeyID = token.p11.C_GenerateKey - (wrappingSession.id(), - new CK_MECHANISM(CKM_AES_KEY_GEN), - wrappingAttributes); - byte[] iv = new byte[16]; - JCAUtil.getSecureRandom().nextBytes(iv); - nativeKeyWrapperMechanism = new CK_MECHANISM - (CKM_AES_CBC_PAD, iv); - } catch (PKCS11Exception e) { - // best effort - } finally { - token.releaseSession(wrappingSession); + if (nativeKeyWrapperKeyID == 0) { + createNativeKeyWrapper(token); + } + // If a wrapper-key was successfully created or + // already exists, increment its reference + // counter to keep it alive while native key + // information is being held. + if (nativeKeyWrapperKeyID != 0) { + nativeKeyWrapperRefCount++; + wrapperKeyUsed = true; } } } @@ -1188,7 +1235,8 @@ try { opSession = token.getOpSession(); ki = p11Key.token.p11.getNativeKeyInfo(opSession.id(), - keyID, nativeKeyWrapperKeyID, nativeKeyWrapperMechanism); + keyID, nativeKeyWrapperKeyID, + nativeKeyWrapperMechanism); } catch (PKCS11Exception e) { // best effort } finally { @@ -1198,6 +1246,8 @@ // best effort } } + this.ref = new SessionKeyRef(p11Key, keyID, wrapperKeyUsed, + keySession); } this.nativeKeyInfo = ((ki == null || ki.length == 0)? null : ki); } @@ -1214,18 +1264,15 @@ throw new RuntimeException( "Error: null keyID with non-zero refCount " + cnt); } - if (this.ref != null) { - throw new RuntimeException( - "Error: null keyID with non-null session ref"); - } Token token = p11Key.token; // Create keyID using nativeKeyInfo Session session = null; try { session = token.getObjSession(); this.keyID = token.p11.createNativeKey(session.id(), - nativeKeyInfo, nativeKeyWrapperKeyID, nativeKeyWrapperMechanism); - this.ref = new SessionKeyRef(p11Key, this.keyID, session); + nativeKeyInfo, nativeKeyWrapperKeyID, + nativeKeyWrapperMechanism); + this.ref.registerNativeKey(this.keyID, session); } catch (PKCS11Exception e) { this.refCount--; throw new ProviderException("Error recreating native key", e); @@ -1255,12 +1302,9 @@ throw new RuntimeException("ERROR: null keyID can't be destroyed"); } - if (this.ref == null) { - throw new RuntimeException("ERROR: null session ref can't be disposed"); - } // destroy this.keyID = 0; - this.ref = this.ref.dispose(); + this.ref.removeNativeKey(); } else { if (cnt < 0) { // should never happen as we start count at 1 and pair get/release calls @@ -1277,12 +1321,11 @@ * otherwise the key maybe cleared before other objects which * still use these keys during finalization such as SSLSocket. */ -final class SessionKeyRef extends PhantomReference<P11Key> - implements Comparable<SessionKeyRef> { +final class SessionKeyRef extends PhantomReference<P11Key> { private static ReferenceQueue<P11Key> refQueue = new ReferenceQueue<P11Key>(); - private static Set<SessionKeyRef> refList = - Collections.synchronizedSortedSet(new TreeSet<SessionKeyRef>()); + private static Set<SessionKeyRef> refSet = + Collections.synchronizedSet(new HashSet<SessionKeyRef>()); static ReferenceQueue<P11Key> referenceQueue() { return refQueue; @@ -1297,48 +1340,70 @@ } // handle to the native key and the session it is generated under - private final long keyID; - private final Session session; + private long keyID; + private Session session; + private boolean wrapperKeyUsed; - SessionKeyRef(P11Key p11Key, long keyID, Session session) { + SessionKeyRef(P11Key p11Key, long keyID, boolean wrapperKeyUsed, + Session session) { super(p11Key, refQueue); if (session == null) { throw new ProviderException("key must be associated with a session"); } - this.keyID = keyID; - this.session = session; - this.session.addObject(); + registerNativeKey(keyID, session); + this.wrapperKeyUsed = wrapperKeyUsed; - refList.add(this); + refSet.add(this); // TBD: run at some interval and not every time? drainRefQueueBounded(); } - SessionKeyRef dispose() { - Token token = session.token; - // If the token is still valid, try to remove the key object - if (token.isValid()) { - Session s = null; - try { - s = token.getOpSession(); - token.p11.C_DestroyObject(s.id(), keyID); - } catch (PKCS11Exception e) { - // best effort - } finally { - token.releaseSession(s); - } - } - refList.remove(this); - this.clear(); - session.removeObject(); - return null; + void registerNativeKey(long newKeyID, Session newSession) { + assert(newKeyID != 0); + assert(newSession != null); + updateNativeKey(newKeyID, newSession); + } + + void removeNativeKey() { + assert(session != null); + updateNativeKey(0, null); } - public int compareTo(SessionKeyRef other) { - if (this.keyID == other.keyID) { - return 0; + private void updateNativeKey(long newKeyID, Session newSession) { + if (newKeyID == 0) { + assert(newSession == null); + Token token = session.token; + // If the token is still valid, try to remove the key object + if (token.isValid()) { + Session s = null; + try { + s = token.getOpSession(); + token.p11.C_DestroyObject(s.id(), this.keyID); + } catch (PKCS11Exception e) { + // best effort + } finally { + token.releaseSession(s); + } + } + session.removeObject(); } else { - return (this.keyID < other.keyID) ? -1 : 1; + newSession.addObject(); } + keyID = newKeyID; + session = newSession; + } + + // Called when the GC disposes a p11Key + void dispose() { + if (wrapperKeyUsed) { + // Wrapper-key no longer needed for + // p11Key native key information + NativeKeyHolder.decWrapperKeyRef(); + } + if (keyID != 0) { + removeNativeKey(); + } + refSet.remove(this); + this.clear(); } }
--- a/src/share/classes/sun/security/ssl/EllipticCurvesExtension.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/security/ssl/EllipticCurvesExtension.java Wed Oct 23 15:35:04 2019 +0100 @@ -168,20 +168,11 @@ "contains no supported elliptic curves"); } } else { // default curves - int[] ids; - if (requireFips) { - ids = new int[] { - // only NIST curves in FIPS mode - 23, 24, 25, 9, 10, 11, 12, 13, 14, - }; - } else { - ids = new int[] { - // NIST curves first - 23, 24, 25, 9, 10, 11, 12, 13, 14, - // non-NIST curves - 22, - }; - } + int[] ids = new int[] { + // The three widely-used NIST curves: + // secp256r1, secp384r1 & secp521r1 + 23, 24, 25 + }; idList = new ArrayList<>(ids.length); for (int curveId : ids) {
--- a/src/share/classes/sun/security/util/ArrayUtil.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/security/util/ArrayUtil.java Wed Oct 23 15:35:04 2019 +0100 @@ -25,34 +25,12 @@ package sun.security.util; -import java.util.List; -import java.util.function.BiFunction; -import java.security.*; -import jdk.internal.util.Preconditions; - - /** * This class holds the various utility methods for array range checks. */ public final class ArrayUtil { - private static final BiFunction<String, List<Integer>, - ArrayIndexOutOfBoundsException> AIOOBE_SUPPLIER = - Preconditions.outOfBoundsExceptionFormatter - (ArrayIndexOutOfBoundsException::new); - - public static void blockSizeCheck(int len, int blockSize) { - if ((len % blockSize) != 0) { - throw new ProviderException("Internal error in input buffering"); - } - } - - public static void nullAndBoundsCheck(byte[] array, int offset, int len) { - // NPE is thrown when array is null - Preconditions.checkFromIndexSize(offset, len, array.length, AIOOBE_SUPPLIER); - } - private static void swap(byte[] arr, int i, int j) { byte tmp = arr[i]; arr[i] = arr[j];
--- a/src/share/classes/sun/security/util/SecurityConstants.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/security/util/SecurityConstants.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, 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 @@ -176,6 +176,10 @@ public static final NetPermission GET_RESPONSECACHE_PERMISSION = new NetPermission("getResponseCache"); + // java.net.ServerSocket, java.net.Socket + public static final NetPermission SET_SOCKETIMPL_PERMISSION = + new NetPermission("setSocketImpl"); + // java.lang.SecurityManager, sun.applet.AppletPanel, sun.misc.Launcher public static final RuntimePermission CREATE_CLASSLOADER_PERMISSION = new RuntimePermission("createClassLoader");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/classes/sun/security/util/SecurityProperties.java Wed Oct 23 15:35:04 2019 +0100 @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 SAP SE. 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 sun.security.util; + +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.Security; + +public class SecurityProperties { + + /** + * Returns the value of the security property propName, which can be overridden + * by a system property of the same name + * + * @param propName the name of the system or security property + * @return the value of the system or security property + */ + public static String privilegedGetOverridable(String propName) { + if (System.getSecurityManager() == null) { + return getOverridableProperty(propName); + } else { + return AccessController.doPrivileged((PrivilegedAction<String>) () -> getOverridableProperty(propName)); + } + } + + private static String getOverridableProperty(String propName) { + String val = System.getProperty(propName); + if (val == null) { + return Security.getProperty(propName); + } else { + return val; + } + } + + /** + * Returns true in case the system or security property "jdk.includeInExceptions" + * contains the category refName + * + * @param refName the category to check + * @return true in case the system or security property "jdk.includeInExceptions" + * contains refName, false otherwise + */ + public static boolean includedInExceptions(String refName) { + String val = privilegedGetOverridable("jdk.includeInExceptions"); + if (val == null) { + return false; + } + + String[] tokens = val.split(","); + for (String token : tokens) { + token = token.trim(); + if (token.equalsIgnoreCase(refName)) { + return true; + } + } + return false; + } +}
--- a/src/share/classes/sun/swing/SwingUtilities2.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/swing/SwingUtilities2.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2019, 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 @@ -505,11 +505,15 @@ String trimmedText = trimTrailingSpaces(text); if (!trimmedText.isEmpty()) { float screenWidth = (float) g2d.getFont().getStringBounds - (trimmedText, DEFAULT_FRC).getWidth(); + (trimmedText, getFontRenderContext(c)).getWidth(); TextLayout layout = createTextLayout(c, text, g2d.getFont(), g2d.getFontRenderContext()); - layout = layout.getJustifiedLayout(screenWidth); + // If text fits the screenWidth, then do not need to justify + if (SwingUtilities2.stringWidth(c, g2d.getFontMetrics(), + trimmedText) > screenWidth) { + layout = layout.getJustifiedLayout(screenWidth); + } /* Use alternate print color if specified */ Color col = g2d.getColor(); if (col instanceof PrintColorUIResource) { @@ -634,8 +638,12 @@ g2d.getFontRenderContext()); if (isPrinting) { float screenWidth = (float)g2d.getFont(). - getStringBounds(text, DEFAULT_FRC).getWidth(); - layout = layout.getJustifiedLayout(screenWidth); + getStringBounds(text, getFontRenderContext(c)).getWidth(); + // If text fits the screenWidth, then do not need to justify + if (SwingUtilities2.stringWidth(c, g2d.getFontMetrics(), + text) > screenWidth) { + layout = layout.getJustifiedLayout(screenWidth); + } } TextHitInfo leading = TextHitInfo.leading(underlinedIndex); @@ -798,7 +806,11 @@ if (!trimmedText.isEmpty()) { float screenWidth = (float)g2d.getFont(). getStringBounds(trimmedText, frc).getWidth(); - layout = layout.getJustifiedLayout(screenWidth); + // If text fits the screenWidth, then do not need to justify + if (SwingUtilities2.stringWidth(c, g2d.getFontMetrics(), + trimmedText) > screenWidth) { + layout = layout.getJustifiedLayout(screenWidth); + } /* Use alternate print color if specified */ Color col = g2d.getColor();
--- a/src/share/classes/sun/text/resources/es/FormatData_es_PE.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/text/resources/es/FormatData_es_PE.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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 @@ -63,6 +63,21 @@ "hh:mm a", // short time pattern } }, + { "NumberElements", + new String[] { + ".", // decimal separator + ",", // group (thousands) separator + ";", // list separator + "%", // percent sign + "0", // native 0 digit + "#", // pattern digit + "-", // minus sign + "E", // exponential + "\u2030", // per mille + "\u221e", // infinity + "\ufffd" // NaN + } + }, { "DatePatterns", new String[] { "EEEE d' de 'MMMM' de 'yyyy", // full date pattern
--- a/src/share/classes/sun/util/calendar/ZoneInfoFile.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/classes/sun/util/calendar/ZoneInfoFile.java Wed Oct 23 15:35:04 2019 +0100 @@ -609,12 +609,8 @@ // we can then pass in the dom = -1, dow > 0 into ZoneInfo // // hacking, assume the >=24 is the result of ZRB optimization for - // "last", it works for now. From tzdata2019a this hacking - // will not work for Asia/Gaza and Asia/Hebron which follow - // Palestine DST rules. - if (dom < 0 || dom >= 24 && - !(zoneId.equals("Asia/Gaza") || - zoneId.equals("Asia/Hebron"))) { + // "last", it works for now. + if (dom < 0 || dom >= 24) { params[1] = -1; params[2] = toCalendarDOW[dow]; } else { @@ -649,8 +645,6 @@ dstSavings = (startRule.offsetAfter - startRule.offsetBefore) * 1000; // Note: known mismatching -> Asia/Amman - // Asia/Gaza - // Asia/Hebron // ZoneInfo : startDayOfWeek=5 <= Thursday // startTime=86400000 <= 24 hours // This: startDayOfWeek=6 @@ -659,18 +653,14 @@ // its endDayOfWeek and endTime // Below is the workarounds, it probably slows down everyone a little if (params[2] == 6 && params[3] == 0 && - (zoneId.equals("Asia/Amman") || - zoneId.equals("Asia/Gaza") || - zoneId.equals("Asia/Hebron"))) { + (zoneId.equals("Asia/Amman"))) { params[2] = 5; params[3] = 86400000; } // Additional check for startDayOfWeek=6 and starTime=86400000 - // is needed for Asia/Amman; Asia/Gasa and Asia/Hebron + // is needed for Asia/Amman; if (params[2] == 7 && params[3] == 0 && - (zoneId.equals("Asia/Amman") || - zoneId.equals("Asia/Gaza") || - zoneId.equals("Asia/Hebron"))) { + (zoneId.equals("Asia/Amman"))) { params[2] = 6; // Friday params[3] = 86400000; // 24h }
--- a/src/share/lib/security/java.security-aix Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/lib/security/java.security-aix Wed Oct 23 15:35:04 2019 +0100 @@ -1012,3 +1012,32 @@ # if this property is not enabled. # jdk.security.caDistrustPolicies=SYMANTEC_TLS + +# +# Policies for the proxy_impersonator Kerberos ccache configuration entry +# +# The proxy_impersonator ccache configuration entry indicates that the ccache +# is a synthetic delegated credential for use with S4U2Proxy by an intermediate +# server. The ccache file should also contain the TGT of this server and +# an evidence ticket from the default principal of the ccache to this server. +# +# This security property determines how Java uses this configuration entry. +# There are 3 possible values: +# +# no-impersonate - Ignore this configuration entry, and always act as +# the owner of the TGT (if it exists). +# +# try-impersonate - Try impersonation when this configuration entry exists. +# If no matching TGT or evidence ticket is found, +# fallback to no-impersonate. +# +# always-impersonate - Always impersonate when this configuration entry exists. +# If no matching TGT or evidence ticket is found, +# no initial credential is read from the ccache. +# +# The default value is "always-impersonate". +# +# If a system property of the same name is also specified, it supersedes the +# security property value defined here. +# +#jdk.security.krb5.default.initiate.credential=always-impersonate \ No newline at end of file
--- a/src/share/lib/security/java.security-linux Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/lib/security/java.security-linux Wed Oct 23 15:35:04 2019 +0100 @@ -1018,3 +1018,32 @@ # if this property is not enabled. # jdk.security.caDistrustPolicies=SYMANTEC_TLS + +# +# Policies for the proxy_impersonator Kerberos ccache configuration entry +# +# The proxy_impersonator ccache configuration entry indicates that the ccache +# is a synthetic delegated credential for use with S4U2Proxy by an intermediate +# server. The ccache file should also contain the TGT of this server and +# an evidence ticket from the default principal of the ccache to this server. +# +# This security property determines how Java uses this configuration entry. +# There are 3 possible values: +# +# no-impersonate - Ignore this configuration entry, and always act as +# the owner of the TGT (if it exists). +# +# try-impersonate - Try impersonation when this configuration entry exists. +# If no matching TGT or evidence ticket is found, +# fallback to no-impersonate. +# +# always-impersonate - Always impersonate when this configuration entry exists. +# If no matching TGT or evidence ticket is found, +# no initial credential is read from the ccache. +# +# The default value is "always-impersonate". +# +# If a system property of the same name is also specified, it supersedes the +# security property value defined here. +# +#jdk.security.krb5.default.initiate.credential=always-impersonate \ No newline at end of file
--- a/src/share/lib/security/java.security-macosx Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/lib/security/java.security-macosx Wed Oct 23 15:35:04 2019 +0100 @@ -1016,3 +1016,32 @@ # if this property is not enabled. # jdk.security.caDistrustPolicies=SYMANTEC_TLS + +# +# Policies for the proxy_impersonator Kerberos ccache configuration entry +# +# The proxy_impersonator ccache configuration entry indicates that the ccache +# is a synthetic delegated credential for use with S4U2Proxy by an intermediate +# server. The ccache file should also contain the TGT of this server and +# an evidence ticket from the default principal of the ccache to this server. +# +# This security property determines how Java uses this configuration entry. +# There are 3 possible values: +# +# no-impersonate - Ignore this configuration entry, and always act as +# the owner of the TGT (if it exists). +# +# try-impersonate - Try impersonation when this configuration entry exists. +# If no matching TGT or evidence ticket is found, +# fallback to no-impersonate. +# +# always-impersonate - Always impersonate when this configuration entry exists. +# If no matching TGT or evidence ticket is found, +# no initial credential is read from the ccache. +# +# The default value is "always-impersonate". +# +# If a system property of the same name is also specified, it supersedes the +# security property value defined here. +# +#jdk.security.krb5.default.initiate.credential=always-impersonate \ No newline at end of file
--- a/src/share/lib/security/java.security-solaris Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/lib/security/java.security-solaris Wed Oct 23 15:35:04 2019 +0100 @@ -1015,3 +1015,32 @@ # if this property is not enabled. # jdk.security.caDistrustPolicies=SYMANTEC_TLS + +# +# Policies for the proxy_impersonator Kerberos ccache configuration entry +# +# The proxy_impersonator ccache configuration entry indicates that the ccache +# is a synthetic delegated credential for use with S4U2Proxy by an intermediate +# server. The ccache file should also contain the TGT of this server and +# an evidence ticket from the default principal of the ccache to this server. +# +# This security property determines how Java uses this configuration entry. +# There are 3 possible values: +# +# no-impersonate - Ignore this configuration entry, and always act as +# the owner of the TGT (if it exists). +# +# try-impersonate - Try impersonation when this configuration entry exists. +# If no matching TGT or evidence ticket is found, +# fallback to no-impersonate. +# +# always-impersonate - Always impersonate when this configuration entry exists. +# If no matching TGT or evidence ticket is found, +# no initial credential is read from the ccache. +# +# The default value is "always-impersonate". +# +# If a system property of the same name is also specified, it supersedes the +# security property value defined here. +# +#jdk.security.krb5.default.initiate.credential=always-impersonate \ No newline at end of file
--- a/src/share/lib/security/java.security-windows Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/lib/security/java.security-windows Wed Oct 23 15:35:04 2019 +0100 @@ -1016,3 +1016,32 @@ # if this property is not enabled. # jdk.security.caDistrustPolicies=SYMANTEC_TLS + +# +# Policies for the proxy_impersonator Kerberos ccache configuration entry +# +# The proxy_impersonator ccache configuration entry indicates that the ccache +# is a synthetic delegated credential for use with S4U2Proxy by an intermediate +# server. The ccache file should also contain the TGT of this server and +# an evidence ticket from the default principal of the ccache to this server. +# +# This security property determines how Java uses this configuration entry. +# There are 3 possible values: +# +# no-impersonate - Ignore this configuration entry, and always act as +# the owner of the TGT (if it exists). +# +# try-impersonate - Try impersonation when this configuration entry exists. +# If no matching TGT or evidence ticket is found, +# fallback to no-impersonate. +# +# always-impersonate - Always impersonate when this configuration entry exists. +# If no matching TGT or evidence ticket is found, +# no initial credential is read from the ccache. +# +# The default value is "always-impersonate". +# +# If a system property of the same name is also specified, it supersedes the +# security property value defined here. +# +#jdk.security.krb5.default.initiate.credential=always-impersonate \ No newline at end of file
--- a/src/share/native/sun/awt/libpng/CHANGES Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/awt/libpng/CHANGES Wed Oct 23 15:35:04 2019 +0100 @@ -6063,9 +6063,47 @@ Added missing parentheses to a macro definition (suggested by "irwir" in GitHub issue #216) -Send comments/corrections/commendations to png-mng-implement at lists.sf.net -(subscription required; visit +Version 1.6.36 [December 1, 2018] + Optimized png_do_expand_palette for ARM processors. + Improved performance by around 10-22% on a recent ARM Chromebook. + (Contributed by Richard Townsend, ARM Holdings) + Fixed manipulation of machine-specific optimization options. + (Contributed by Vicki Pfau) + Used memcpy instead of manual pointer arithmetic on Intel SSE2. + (Contributed by Samuel Williams) + Fixed build errors with MSVC on ARM64. + (Contributed by Zhijie Liang) + Fixed detection of libm in CMakeLists. + (Contributed by Cameron Cawley) + Fixed incorrect creation of pkg-config file in CMakeLists. + (Contributed by Kyle Bentley) + Fixed the CMake build on Windows MSYS by avoiding symlinks. + Fixed a build warning on OpenBSD. + (Contributed by Theo Buehler) + Fixed various typos in comments. + (Contributed by "luz.paz") + Raised the minimum required CMake version from 3.0.2 to 3.1. + Removed yet more of the vestigial support for pre-ANSI C compilers. + Removed ancient makefiles for ancient systems that have been broken + across all previous libpng-1.6.x versions. + Removed the Y2K compliance statement and the export control + information. + Applied various code style and documentation fixes. + +Version 1.6.37 [April 14, 2019] + Fixed a use-after-free vulnerability (CVE-2019-7317) in png_image_free. + Fixed a memory leak in the ARM NEON implementation of png_do_expand_palette. + Fixed a memory leak in pngtest.c. + Fixed two vulnerabilities (CVE-2018-14048, CVE-2018-14550) in + contrib/pngminus; refactor. + Changed the license of contrib/pngminus to MIT; refresh makefile and docs. + (Contributed by Willem van Schaik) + Fixed a typo in the libpng license v2. + (Contributed by Miguel Ojeda) + Added makefiles for AddressSanitizer-enabled builds. + Cleaned up various makefiles. + +Send comments/corrections/commendations to png-mng-implement at lists.sf.net. +Subscription is required; visit https://lists.sourceforge.net/lists/listinfo/png-mng-implement -to subscribe). - -Glenn R-P +to subscribe.
--- a/src/share/native/sun/awt/libpng/LICENSE Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/awt/libpng/LICENSE Wed Oct 23 15:35:04 2019 +0100 @@ -1,53 +1,82 @@ +COPYRIGHT NOTICE, DISCLAIMER, and LICENSE +========================================= -This copy of the libpng notices is provided for your convenience. In case of -any discrepancy between this copy and the notices in the file png.h that is -included in the libpng distribution, the latter shall prevail. +PNG Reference Library License version 2 +--------------------------------------- -COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: + * Copyright (c) 1995-2019 The PNG Reference Library Authors. + * Copyright (c) 2018-2019 Cosmin Truta. + * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson. + * Copyright (c) 1996-1997 Andreas Dilger. + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. -If you modify libpng you may insert additional notices immediately following -this sentence. +The software is supplied "as is", without warranty of any kind, +express or implied, including, without limitation, the warranties +of merchantability, fitness for a particular purpose, title, and +non-infringement. In no event shall the Copyright owners, or +anyone distributing the software, be liable for any damages or +other liability, whether in contract, tort or otherwise, arising +from, out of, or in connection with the software, or the use or +other dealings in the software, even if advised of the possibility +of such damage. + +Permission is hereby granted to use, copy, modify, and distribute +this software, or portions hereof, for any purpose, without fee, +subject to the following restrictions: -This code is released under the libpng license. + 1. The origin of this software must not be misrepresented; you + must not claim that you wrote the original software. If you + use this software in a product, an acknowledgment in the product + documentation would be appreciated, but is not required. + + 2. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. -libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are + 3. This Copyright notice may not be removed or altered from any + source or altered source distribution. + + +PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35) +----------------------------------------------------------------------- + +libpng versions 1.0.7, July 1, 2000, through 1.6.35, July 15, 2018 are Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are derived from libpng-1.0.6, and are distributed according to the same disclaimer and license as libpng-1.0.6 with the following individuals added to the list of Contributing Authors: - Simon-Pierre Cadieux - Eric S. Raymond - Mans Rullgard - Cosmin Truta - Gilles Vollant - James Yu - Mandar Sahastrabuddhe - Google Inc. - Vadim Barkov + Simon-Pierre Cadieux + Eric S. Raymond + Mans Rullgard + Cosmin Truta + Gilles Vollant + James Yu + Mandar Sahastrabuddhe + Google Inc. + Vadim Barkov and with the following additions to the disclaimer: - There is no warranty against interference with your enjoyment of the - library or against infringement. There is no warranty that our - efforts or the library will fulfill any of your particular purposes - or needs. This library is provided with all faults, and the entire - risk of satisfactory quality, performance, accuracy, and effort is with - the user. + There is no warranty against interference with your enjoyment of + the library or against infringement. There is no warranty that our + efforts or the library will fulfill any of your particular purposes + or needs. This library is provided with all faults, and the entire + risk of satisfactory quality, performance, accuracy, and effort is + with the user. Some files in the "contrib" directory and some configure-generated -files that are distributed with libpng have other copyright owners and +files that are distributed with libpng have other copyright owners, and are released under other open source licenses. libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from libpng-0.96, and are distributed according to the same disclaimer and -license as libpng-0.96, with the following individuals added to the list -of Contributing Authors: +license as libpng-0.96, with the following individuals added to the +list of Contributing Authors: - Tom Lane - Glenn Randers-Pehrson - Willem van Schaik + Tom Lane + Glenn Randers-Pehrson + Willem van Schaik libpng versions 0.89, June 1996, through 0.96, May 1997, are Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88, @@ -55,14 +84,14 @@ libpng-0.88, with the following individuals added to the list of Contributing Authors: - John Bowler - Kevin Bracey - Sam Bushell - Magnus Holmgren - Greg Roelofs - Tom Tanner + John Bowler + Kevin Bracey + Sam Bushell + Magnus Holmgren + Greg Roelofs + Tom Tanner -Some files in the "scripts" directory have other copyright owners +Some files in the "scripts" directory have other copyright owners, but are released under this license. libpng versions 0.5, May 1995, through 0.88, January 1996, are @@ -71,63 +100,35 @@ For the purposes of this copyright and license, "Contributing Authors" is defined as the following set of individuals: - Andreas Dilger - Dave Martindale - Guy Eric Schalnat - Paul Schmidt - Tim Wegner + Andreas Dilger + Dave Martindale + Guy Eric Schalnat + Paul Schmidt + Tim Wegner -The PNG Reference Library is supplied "AS IS". The Contributing Authors -and Group 42, Inc. disclaim all warranties, expressed or implied, -including, without limitation, the warranties of merchantability and of -fitness for any purpose. The Contributing Authors and Group 42, Inc. -assume no liability for direct, indirect, incidental, special, exemplary, -or consequential damages, which may result from the use of the PNG -Reference Library, even if advised of the possibility of such damage. +The PNG Reference Library is supplied "AS IS". The Contributing +Authors and Group 42, Inc. disclaim all warranties, expressed or +implied, including, without limitation, the warranties of +merchantability and of fitness for any purpose. The Contributing +Authors and Group 42, Inc. assume no liability for direct, indirect, +incidental, special, exemplary, or consequential damages, which may +result from the use of the PNG Reference Library, even if advised of +the possibility of such damage. Permission is hereby granted to use, copy, modify, and distribute this source code, or portions hereof, for any purpose, without fee, subject to the following restrictions: - 1. The origin of this source code must not be misrepresented. - - 2. Altered versions must be plainly marked as such and must not - be misrepresented as being the original source. - - 3. This Copyright notice may not be removed or altered from any - source or altered source distribution. + 1. The origin of this source code must not be misrepresented. -The Contributing Authors and Group 42, Inc. specifically permit, without -fee, and encourage the use of this source code as a component to -supporting the PNG file format in commercial products. If you use this -source code in a product, acknowledgment is not required but would be -appreciated. - -END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE. - -TRADEMARK: + 2. Altered versions must be plainly marked as such and must not + be misrepresented as being the original source. -The name "libpng" has not been registered by the Copyright owner -as a trademark in any jurisdiction. However, because libpng has -been distributed and maintained world-wide, continually since 1995, -the Copyright owner claims "common-law trademark protection" in any -jurisdiction where common-law trademark is recognized. - -OSI CERTIFICATION: - -Libpng is OSI Certified Open Source Software. OSI Certified Open Source is -a certification mark of the Open Source Initiative. OSI has not addressed -the additional disclaimers inserted at version 1.0.7. + 3. This Copyright notice may not be removed or altered from any + source or altered source distribution. -EXPORT CONTROL: - -The Copyright owner believes that the Export Control Classification -Number (ECCN) for libpng is EAR99, which means not subject to export -controls or International Traffic in Arms Regulations (ITAR) because -it is open source, publicly available software, that does not contain -any encryption software. See the EAR, paragraphs 734.3(b)(3) and -734.7(b). - -Glenn Randers-Pehrson -glennrp at users.sourceforge.net -July 15, 2018 +The Contributing Authors and Group 42, Inc. specifically permit, +without fee, and encourage the use of this source code as a component +to supporting the PNG file format in commercial products. If you use +this source code in a product, acknowledgment is not required but would +be appreciated.
--- a/src/share/native/sun/awt/libpng/README Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/awt/libpng/README Wed Oct 23 15:35:04 2019 +0100 @@ -1,15 +1,16 @@ -README for libpng version 1.6.35 - July 15, 2018 (shared library 16.0) -See the note about version numbers near the top of png.h +README for libpng version 1.6.37 - April 14, 2019 +================================================= +See the note about version numbers near the top of png.h. See INSTALL for instructions on how to install libpng. Libpng comes in several distribution formats. Get libpng-*.tar.gz or -libpng-*.tar.xz or if you want UNIX-style line endings in the text files, -or lpng*.7z or lpng*.zip if you want DOS-style line endings. +libpng-*.tar.xz or if you want UNIX-style line endings in the text +files, or lpng*.7z or lpng*.zip if you want DOS-style line endings. Version 0.89 was the first official release of libpng. Don't let the -fact that it's the first release fool you. The libpng library has been in -extensive use and testing since mid-1995. By late 1997 it had +fact that it's the first release fool you. The libpng library has been +in extensive use and testing since mid-1995. By late 1997 it had finally gotten to the stage where there hadn't been significant changes to the API in some time, and people have a bad feeling about libraries with versions < 1.0. Version 1.0.0 was released in @@ -60,59 +61,37 @@ to set different actions based on whether the CRC error occurred in a critical or an ancillary chunk. -The changes made to the library, and bugs fixed are based on discussions -on the PNG-implement mailing list and not on material submitted -privately to Guy, Andreas, or Glenn. They will forward any good -suggestions to the list. - -For a detailed description on using libpng, read libpng-manual.txt. For -examples of libpng in a program, see example.c and pngtest.c. For usage -information and restrictions (what little they are) on libpng, see -png.h. For a description on using zlib (the compression library used by -libpng) and zlib's restrictions, see zlib.h +For a detailed description on using libpng, read libpng-manual.txt. +For examples of libpng in a program, see example.c and pngtest.c. For +usage information and restrictions (what little they are) on libpng, +see png.h. For a description on using zlib (the compression library +used by libpng) and zlib's restrictions, see zlib.h I have included a general makefile, as well as several machine and -compiler specific ones, but you may have to modify one for your own needs. +compiler specific ones, but you may have to modify one for your own +needs. You should use zlib 1.0.4 or later to run this, but it MAY work with versions as old as zlib 0.95. Even so, there are bugs in older zlib versions which can cause the output of invalid compression streams for -some images. You will definitely need zlib 1.0.4 or later if you are -taking advantage of the MS-DOS "far" structure allocation for the small -and medium memory models. You should also note that zlib is a -compression library that is useful for more things than just PNG files. -You can use zlib as a drop-in replacement for fread() and fwrite() if -you are so inclined. +some images. -zlib should be available at the same place that libpng is, or at zlib.net. +You should also note that zlib is a compression library that is useful +for more things than just PNG files. You can use zlib as a drop-in +replacement for fread() and fwrite(), if you are so inclined. + +zlib should be available at the same place that libpng is, or at +https://zlib.net. You may also want a copy of the PNG specification. It is available as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find these at http://www.libpng.org/pub/png/pngdocs.html . This code is currently being archived at libpng.sourceforge.io in the -[DOWNLOAD] area, and at http://libpng.download/src . If you -can't find it in any of those places, e-mail me, and I'll help you find it. - -I am not a lawyer, but I believe that the Export Control Classification -Number (ECCN) for libpng is EAR99, which means not subject to export -controls or International Traffic in Arms Regulations (ITAR) because it -is open source, publicly available software, that does not contain any -encryption software. See the EAR, paragraphs 734.3(b)(3) and 734.7(b). +[DOWNLOAD] area, and at http://libpng.download/src . -If you have any code changes, requests, problems, etc., please e-mail -them to me. Also, I'd appreciate any make files or project files, -and any modifications you needed to make to get libpng to compile, -along with a #define variable to tell what compiler/system you are on. -If you needed to add transformations to libpng, or wish libpng would -provide the image in a different way, drop me a note (and code, if -possible), so I can consider supporting the transformation. -Finally, if you get any warning messages when compiling libpng -(note: not zlib), and they are easy to fix, I'd appreciate the -fix. Please mention "libpng" somewhere in the subject line. Thanks. - -This release was created and will be supported by myself (of course -based in a large way on Guy's and Andreas' earlier work), and the PNG +This release, based in a large way on Glenn's, Guy's and Andreas' +earlier work, was created and will be supported by myself and the PNG development group. Send comments/corrections/commendations to png-mng-implement at @@ -120,34 +99,21 @@ https://lists.sourceforge.net/lists/listinfo/png-mng-implement to subscribe). -You can't reach Guy, the original libpng author, at the addresses -given in previous versions of this document. He and Andreas will -read mail addressed to the png-implement list, however. - -Please do not send general questions about PNG. Send them to -png-mng-misc at lists.sf.net (subscription required; visit +Send general questions about the PNG specification to png-mng-misc +at lists.sourceforge.net (subscription required; visit https://lists.sourceforge.net/lists/listinfo/png-mng-misc to -subscribe). If you have a question about something -in the PNG specification that is related to using libpng, send it -to me. Send me any questions that start with "I was using libpng, -and ...". If in doubt, send questions to me. I'll bounce them -to others, if necessary. - -Please do not send suggestions on how to change PNG. We have -been discussing PNG for twenty years now, and it is official and -finished. If you have suggestions for libpng, however, I'll -gladly listen. Even if your suggestion is not used immediately, -it may be used later. +subscribe). Files in this distribution: ANNOUNCE => Announcement of this version, with recent changes + AUTHORS => List of contributing authors CHANGES => Description of changes between libpng versions KNOWNBUG => List of known bugs and deficiencies LICENSE => License to use and redistribute libpng README => This file TODO => Things not implemented in the current library - Y2KINFO => Statement of Y2K compliance + TRADEMARK => Trademark information example.c => Example code for using libpng functions libpng.3 => manual page for libpng (includes libpng-manual.txt) libpng-manual.txt => Description of libpng and its functions @@ -208,15 +174,10 @@ scripts => Directory containing scripts for building libpng: (see scripts/README.txt for the list of scripts) -Good luck, and happy coding. - --Glenn Randers-Pehrson (current maintainer, since 1998) - Internet: glennrp at users.sourceforge.net +Good luck, and happy coding! --Andreas Eric Dilger (former maintainer, 1996-1997) - Internet: adilger at enel.ucalgary.ca - Web: http://www-mddsp.enel.ucalgary.ca/People/adilger/ - --Guy Eric Schalnat (original author and former maintainer, 1995-1996) - (formerly of Group 42, Inc) - Internet: gschal at infinet.com + * Cosmin Truta (current maintainer, since 2018) + * Glenn Randers-Pehrson (former maintainer, 1998-2018) + * Andreas Eric Dilger (former maintainer, 1996-1997) + * Guy Eric Schalnat (original author and former maintainer, 1995-1996) + (formerly of Group 42, Inc.)
--- a/src/share/native/sun/awt/libpng/png.c Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/awt/libpng/png.c Wed Oct 23 15:35:04 2019 +0100 @@ -29,10 +29,10 @@ * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018-2019 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -42,7 +42,7 @@ #include "pngpriv.h" /* Generate a compiler error if there is an old png.h in the search path. */ -typedef png_libpng_version_1_6_35 Your_png_h_is_not_version_1_6_35; +typedef png_libpng_version_1_6_37 Your_png_h_is_not_version_1_6_37; #ifdef __GNUC__ /* The version tests may need to be added to, but the problem warning has @@ -764,7 +764,7 @@ int PNGAPI png_convert_to_rfc1123_buffer(char out[29], png_const_timep ptime) { - static PNG_CONST char short_months[12][4] = + static const char short_months[12][4] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; @@ -842,20 +842,14 @@ #ifdef PNG_STRING_COPYRIGHT return PNG_STRING_COPYRIGHT #else -# ifdef __STDC__ return PNG_STRING_NEWLINE \ - "libpng version 1.6.35 - July 15, 2018" PNG_STRING_NEWLINE \ + "libpng version 1.6.37" PNG_STRING_NEWLINE \ + "Copyright (c) 2018-2019 Cosmin Truta" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \ PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ PNG_STRING_NEWLINE; -# else - return "libpng version 1.6.35 - July 15, 2018\ - Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson\ - Copyright (c) 1996-1997 Andreas Dilger\ - Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; -# endif #endif } @@ -1149,7 +1143,7 @@ png_colorspacerp colorspace, png_fixed_point gAMA) { /* Changed in libpng-1.5.4 to limit the values to ensure overflow can't - * occur. Since the fixed point representation is asymetrical it is + * occur. Since the fixed point representation is asymmetrical it is * possible for 1/gamma to overflow the limit of 21474 and this means the * gamma value must be at least 5/100000 and hence at most 20000.0. For * safety the limits here are a little narrower. The values are 0.00016 to @@ -3162,11 +3156,11 @@ /* The total output count (max) is now 4+precision */ /* Check for an exponent, if we don't need one we are - * done and just need to terminate the string. At - * this point exp_b10==(-1) is effectively a flag - it got - * to '-1' because of the decrement after outputting - * the decimal point above (the exponent required is - * *not* -1!) + * done and just need to terminate the string. At this + * point, exp_b10==(-1) is effectively a flag: it got + * to '-1' because of the decrement, after outputting + * the decimal point above. (The exponent required is + * *not* -1.) */ if (exp_b10 >= (-1) && exp_b10 <= 2) { @@ -4004,18 +3998,18 @@ */ static void png_build_16bit_table(png_structrp png_ptr, png_uint_16pp *ptable, - PNG_CONST unsigned int shift, PNG_CONST png_fixed_point gamma_val) + unsigned int shift, png_fixed_point gamma_val) { /* Various values derived from 'shift': */ - PNG_CONST unsigned int num = 1U << (8U - shift); + unsigned int num = 1U << (8U - shift); #ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED /* CSE the division and work round wacky GCC warnings (see the comments * in png_gamma_8bit_correct for where these come from.) */ - PNG_CONST double fmax = 1./(((png_int_32)1 << (16U - shift))-1); + double fmax = 1.0 / (((png_int_32)1 << (16U - shift)) - 1); #endif - PNG_CONST unsigned int max = (1U << (16U - shift))-1U; - PNG_CONST unsigned int max_by_2 = 1U << (15U-shift); + unsigned int max = (1U << (16U - shift)) - 1U; + unsigned int max_by_2 = 1U << (15U - shift); unsigned int i; png_uint_16pp table = *ptable = @@ -4081,10 +4075,10 @@ */ static void png_build_16to8_table(png_structrp png_ptr, png_uint_16pp *ptable, - PNG_CONST unsigned int shift, PNG_CONST png_fixed_point gamma_val) + unsigned int shift, png_fixed_point gamma_val) { - PNG_CONST unsigned int num = 1U << (8U - shift); - PNG_CONST unsigned int max = (1U << (16U - shift))-1U; + unsigned int num = 1U << (8U - shift); + unsigned int max = (1U << (16U - shift))-1U; unsigned int i; png_uint_32 last; @@ -4149,7 +4143,7 @@ */ static void png_build_8bit_table(png_structrp png_ptr, png_bytepp ptable, - PNG_CONST png_fixed_point gamma_val) + png_fixed_point gamma_val) { unsigned int i; png_bytep table = *ptable = (png_bytep)png_malloc(png_ptr, 256);
--- a/src/share/native/sun/awt/libpng/png.h Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/awt/libpng/png.h Wed Oct 23 15:35:04 2019 +0100 @@ -29,68 +29,105 @@ * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * - * libpng version 1.6.35, July 15, 2018 + * libpng version 1.6.37 - April 14, 2019 * + * Copyright (c) 2018-2019 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * - * This code is released under the libpng license (See LICENSE, below) + * This code is released under the libpng license. (See LICENSE, below.) * * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.6.35, July 15, 2018: - * Glenn Randers-Pehrson. + * libpng versions 0.97, January 1998, through 1.6.35, July 2018: + * Glenn Randers-Pehrson + * libpng versions 1.6.36, December 2018, through 1.6.37, April 2019: + * Cosmin Truta * See also "Contributing Authors", below. */ /* - * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: + * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE + * ========================================= + * + * PNG Reference Library License version 2 + * --------------------------------------- + * + * * Copyright (c) 1995-2019 The PNG Reference Library Authors. + * * Copyright (c) 2018-2019 Cosmin Truta. + * * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson. + * * Copyright (c) 1996-1997 Andreas Dilger. + * * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * - * If you modify libpng you may insert additional notices immediately following - * this sentence. + * The software is supplied "as is", without warranty of any kind, + * express or implied, including, without limitation, the warranties + * of merchantability, fitness for a particular purpose, title, and + * non-infringement. In no event shall the Copyright owners, or + * anyone distributing the software, be liable for any damages or + * other liability, whether in contract, tort or otherwise, arising + * from, out of, or in connection with the software, or the use or + * other dealings in the software, even if advised of the possibility + * of such damage. + * + * Permission is hereby granted to use, copy, modify, and distribute + * this software, or portions hereof, for any purpose, without fee, + * subject to the following restrictions: * - * This code is released under the libpng license. + * 1. The origin of this software must not be misrepresented; you + * must not claim that you wrote the original software. If you + * use this software in a product, an acknowledgment in the product + * documentation would be appreciated, but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must + * not be misrepresented as being the original software. * - * libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are + * 3. This Copyright notice may not be removed or altered from any + * source or altered source distribution. + * + * + * PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35) + * ----------------------------------------------------------------------- + * + * libpng versions 1.0.7, July 1, 2000, through 1.6.35, July 15, 2018 are * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are * derived from libpng-1.0.6, and are distributed according to the same * disclaimer and license as libpng-1.0.6 with the following individuals * added to the list of Contributing Authors: * - * Simon-Pierre Cadieux - * Eric S. Raymond - * Mans Rullgard - * Cosmin Truta - * Gilles Vollant - * James Yu - * Mandar Sahastrabuddhe - * Google Inc. - * Vadim Barkov + * Simon-Pierre Cadieux + * Eric S. Raymond + * Mans Rullgard + * Cosmin Truta + * Gilles Vollant + * James Yu + * Mandar Sahastrabuddhe + * Google Inc. + * Vadim Barkov * * and with the following additions to the disclaimer: * - * There is no warranty against interference with your enjoyment of the - * library or against infringement. There is no warranty that our - * efforts or the library will fulfill any of your particular purposes - * or needs. This library is provided with all faults, and the entire - * risk of satisfactory quality, performance, accuracy, and effort is with - * the user. + * There is no warranty against interference with your enjoyment of + * the library or against infringement. There is no warranty that our + * efforts or the library will fulfill any of your particular purposes + * or needs. This library is provided with all faults, and the entire + * risk of satisfactory quality, performance, accuracy, and effort is + * with the user. * * Some files in the "contrib" directory and some configure-generated - * files that are distributed with libpng have other copyright owners and + * files that are distributed with libpng have other copyright owners, and * are released under other open source licenses. * * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are * Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from * libpng-0.96, and are distributed according to the same disclaimer and - * license as libpng-0.96, with the following individuals added to the list - * of Contributing Authors: + * license as libpng-0.96, with the following individuals added to the + * list of Contributing Authors: * - * Tom Lane - * Glenn Randers-Pehrson - * Willem van Schaik + * Tom Lane + * Glenn Randers-Pehrson + * Willem van Schaik * * libpng versions 0.89, June 1996, through 0.96, May 1997, are * Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88, @@ -98,14 +135,14 @@ * libpng-0.88, with the following individuals added to the list of * Contributing Authors: * - * John Bowler - * Kevin Bracey - * Sam Bushell - * Magnus Holmgren - * Greg Roelofs - * Tom Tanner + * John Bowler + * Kevin Bracey + * Sam Bushell + * Magnus Holmgren + * Greg Roelofs + * Tom Tanner * - * Some files in the "scripts" directory have other copyright owners + * Some files in the "scripts" directory have other copyright owners, * but are released under this license. * * libpng versions 0.5, May 1995, through 0.88, January 1996, are @@ -114,62 +151,49 @@ * For the purposes of this copyright and license, "Contributing Authors" * is defined as the following set of individuals: * - * Andreas Dilger - * Dave Martindale - * Guy Eric Schalnat - * Paul Schmidt - * Tim Wegner + * Andreas Dilger + * Dave Martindale + * Guy Eric Schalnat + * Paul Schmidt + * Tim Wegner * - * The PNG Reference Library is supplied "AS IS". The Contributing Authors - * and Group 42, Inc. disclaim all warranties, expressed or implied, - * including, without limitation, the warranties of merchantability and of - * fitness for any purpose. The Contributing Authors and Group 42, Inc. - * assume no liability for direct, indirect, incidental, special, exemplary, - * or consequential damages, which may result from the use of the PNG - * Reference Library, even if advised of the possibility of such damage. + * The PNG Reference Library is supplied "AS IS". The Contributing + * Authors and Group 42, Inc. disclaim all warranties, expressed or + * implied, including, without limitation, the warranties of + * merchantability and of fitness for any purpose. The Contributing + * Authors and Group 42, Inc. assume no liability for direct, indirect, + * incidental, special, exemplary, or consequential damages, which may + * result from the use of the PNG Reference Library, even if advised of + * the possibility of such damage. * * Permission is hereby granted to use, copy, modify, and distribute this * source code, or portions hereof, for any purpose, without fee, subject * to the following restrictions: * - * 1. The origin of this source code must not be misrepresented. + * 1. The origin of this source code must not be misrepresented. * - * 2. Altered versions must be plainly marked as such and must not - * be misrepresented as being the original source. + * 2. Altered versions must be plainly marked as such and must not + * be misrepresented as being the original source. * - * 3. This Copyright notice may not be removed or altered from any - * source or altered source distribution. + * 3. This Copyright notice may not be removed or altered from any + * source or altered source distribution. * - * The Contributing Authors and Group 42, Inc. specifically permit, without - * fee, and encourage the use of this source code as a component to - * supporting the PNG file format in commercial products. If you use this - * source code in a product, acknowledgment is not required but would be - * appreciated. + * The Contributing Authors and Group 42, Inc. specifically permit, + * without fee, and encourage the use of this source code as a component + * to supporting the PNG file format in commercial products. If you use + * this source code in a product, acknowledgment is not required but would + * be appreciated. * * END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE. * - * TRADEMARK: + * TRADEMARK + * ========= * - * The name "libpng" has not been registered by the Copyright owner + * The name "libpng" has not been registered by the Copyright owners * as a trademark in any jurisdiction. However, because libpng has * been distributed and maintained world-wide, continually since 1995, - * the Copyright owner claims "common-law trademark protection" in any + * the Copyright owners claim "common-law trademark protection" in any * jurisdiction where common-law trademark is recognized. - * - * OSI CERTIFICATION: - * - * Libpng is OSI Certified Open Source Software. OSI Certified Open Source is - * a certification mark of the Open Source Initiative. OSI has not addressed - * the additional disclaimers inserted at version 1.0.7. - * - * EXPORT CONTROL: - * - * The Copyright owner believes that the Export Control Classification - * Number (ECCN) for libpng is EAR99, which means not subject to export - * controls or International Traffic in Arms Regulations (ITAR) because - * it is open source, publicly available software, that does not contain - * any encryption software. See the EAR, paragraphs 734.3(b)(3) and - * 734.7(b). */ /* @@ -235,23 +259,25 @@ * 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible) * 1.0.7 1 10007 (still compatible) * ... - * 1.0.19 10 10019 10.so.0.19[.0] + * 1.0.69 10 10069 10.so.0.69[.0] * ... - * 1.2.59 13 10257 12.so.0.59[.0] + * 1.2.59 13 10259 12.so.0.59[.0] * ... - * 1.5.30 15 10527 15.so.15.30[.0] + * 1.4.20 14 10420 14.so.0.20[.0] * ... - * 1.6.35 16 10635 16.so.16.35[.0] + * 1.5.30 15 10530 15.so.15.30[.0] + * ... + * 1.6.37 16 10637 16.so.16.37[.0] * - * Henceforth the source version will match the shared-library major - * and minor numbers; the shared-library major version number will be - * used for changes in backward compatibility, as it is intended. The - * PNG_LIBPNG_VER macro, which is not used within libpng but is available - * for applications, is an unsigned integer of the form xyyzz corresponding - * to the source version x.y.z (leading zeros in y and z). Beta versions - * were given the previous public release number plus a letter, until - * version 1.0.6j; from then on they were given the upcoming public - * release number plus "betaNN" or "rcNN". + * Henceforth the source version will match the shared-library major and + * minor numbers; the shared-library major version number will be used for + * changes in backward compatibility, as it is intended. + * The PNG_LIBPNG_VER macro, which is not used within libpng but is + * available for applications, is an unsigned integer of the form XYYZZ + * corresponding to the source version X.Y.Z (leading zeros in Y and Z). + * Beta versions were given the previous public release number plus a + * letter, until version 1.0.6j; from then on they were given the upcoming + * public release number plus "betaNN" or "rcNN". * * Binary incompatibility exists only when applications make direct access * to the info_ptr or png_ptr members through png.h, and the compiled @@ -261,65 +287,8 @@ * in binary compatibility (e.g., when a new feature is added). * * See libpng.txt or libpng.3 for more information. The PNG specification - * is available as a W3C Recommendation and as an ISO Specification, - * <https://www.w3.org/TR/2003/REC-PNG-20031110/ - */ - -/* - * Y2K compliance in libpng: - * ========================= - * - * July 15, 2018 - * - * Since the PNG Development group is an ad-hoc body, we can't make - * an official declaration. - * - * This is your unofficial assurance that libpng from version 0.71 and - * upward through 1.6.35 are Y2K compliant. It is my belief that - * earlier versions were also Y2K compliant. - * - * Libpng only has two year fields. One is a 2-byte unsigned integer - * that will hold years up to 65535. The other, which is deprecated, - * holds the date in text format, and will hold years up to 9999. - * - * The integer is - * "png_uint_16 year" in png_time_struct. - * - * The string is - * "char time_buffer[29]" in png_struct. This is no longer used - * in libpng-1.6.x and will be removed from libpng-1.7.0. - * - * There are seven time-related functions: - * png.c: png_convert_to_rfc_1123_buffer() in png.c - * (formerly png_convert_to_rfc_1123() prior to libpng-1.5.x and - * png_convert_to_rfc_1152() in error prior to libpng-0.98) - * png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c - * png_convert_from_time_t() in pngwrite.c - * png_get_tIME() in pngget.c - * png_handle_tIME() in pngrutil.c, called in pngread.c - * png_set_tIME() in pngset.c - * png_write_tIME() in pngwutil.c, called in pngwrite.c - * - * All handle dates properly in a Y2K environment. The - * png_convert_from_time_t() function calls gmtime() to convert from system - * clock time, which returns (year - 1900), which we properly convert to - * the full 4-digit year. There is a possibility that libpng applications - * are not passing 4-digit years into the png_convert_to_rfc_1123_buffer() - * function, or that they are incorrectly passing only a 2-digit year - * instead of "year - 1900" into the png_convert_from_struct_tm() function, - * but this is not under our control. The libpng documentation has always - * stated that it works with 4-digit years, and the APIs have been - * documented as such. - * - * The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned - * integer to hold the year, and can hold years as large as 65535. - * - * zlib, upon which libpng depends, is also Y2K compliant. It contains - * no date-related code. - * - * Glenn Randers-Pehrson - * libpng maintainer - * PNG Development Group + * is available as a W3C Recommendation and as an ISO/IEC Standard; see + * <https://www.w3.org/TR/2003/REC-PNG-20031110/> */ #ifndef PNG_H @@ -337,8 +306,8 @@ */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.6.35" -#define PNG_HEADER_VERSION_STRING " libpng version 1.6.35 - July 15, 2018\n" +#define PNG_LIBPNG_VER_STRING "1.6.37" +#define PNG_HEADER_VERSION_STRING " libpng version 1.6.37 - April 14, 2019\n" #define PNG_LIBPNG_VER_SONUM 16 #define PNG_LIBPNG_VER_DLLNUM 16 @@ -346,13 +315,12 @@ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 6 -#define PNG_LIBPNG_VER_RELEASE 35 - -/* This should match the numeric part of the final component of - * PNG_LIBPNG_VER_STRING, omitting any leading zero: +#define PNG_LIBPNG_VER_RELEASE 37 + +/* This should be zero for a public release, or non-zero for a + * development version. [Deprecated] */ - -#define PNG_LIBPNG_VER_BUILD 02 +#define PNG_LIBPNG_VER_BUILD 0 /* Release Status */ #define PNG_LIBPNG_BUILD_ALPHA 1 @@ -369,15 +337,16 @@ #define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with PNG_LIBPNG_BUILD_PRIVATE */ -#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_BETA - -/* Careful here. At one time, Guy wanted to use 082, but that would be octal. - * We must not include leading zeros. - * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only - * version 1.0.0 was mis-numbered 100 instead of 10000). From - * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release +#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE + +/* Careful here. At one time, Guy wanted to use 082, but that + * would be octal. We must not include leading zeros. + * Versions 0.7 through 1.0.0 were in the range 0 to 100 here + * (only version 1.0.0 was mis-numbered 100 instead of 10000). + * From version 1.0.1 it is: + * XXYYZZ, where XX=major, YY=minor, ZZ=release */ -#define PNG_LIBPNG_VER 10635 /* 1.6.35 */ +#define PNG_LIBPNG_VER 10637 /* 1.6.37 */ /* Library configuration: these options cannot be changed after * the library has been built. @@ -487,7 +456,7 @@ /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ -typedef char* png_libpng_version_1_6_35; +typedef char* png_libpng_version_1_6_37; /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. * @@ -2041,12 +2010,12 @@ PNG_EXPORT(246, png_uint_32, png_get_eXIf, (png_const_structrp png_ptr, png_inforp info_ptr, png_bytep *exif)); PNG_EXPORT(247, void, png_set_eXIf, (png_const_structrp png_ptr, - png_inforp info_ptr, const png_bytep exif)); + png_inforp info_ptr, png_bytep exif)); PNG_EXPORT(248, png_uint_32, png_get_eXIf_1, (png_const_structrp png_ptr, png_const_inforp info_ptr, png_uint_32 *num_exif, png_bytep *exif)); PNG_EXPORT(249, void, png_set_eXIf_1, (png_const_structrp png_ptr, - png_inforp info_ptr, const png_uint_32 num_exif, const png_bytep exif)); + png_inforp info_ptr, png_uint_32 num_exif, png_bytep exif)); #endif #ifdef PNG_gAMA_SUPPORTED @@ -2792,7 +2761,7 @@ * * When the simplified API needs to convert between sRGB and linear colorspaces, * the actual sRGB transfer curve defined in the sRGB specification (see the - * article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 + * article at <https://en.wikipedia.org/wiki/SRGB>) is used, not the gamma=1/2.2 * approximation used elsewhere in libpng. * * When an alpha channel is present it is expected to denote pixel coverage @@ -2995,7 +2964,7 @@ * 'flags' field of png_image. */ #define PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB 0x01 - /* This indicates the the RGB values of the in-memory bitmap do not + /* This indicates that the RGB values of the in-memory bitmap do not * correspond to the red, green and blue end-points defined by sRGB. */
--- a/src/share/native/sun/awt/libpng/pngconf.h Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/awt/libpng/pngconf.h Wed Oct 23 15:35:04 2019 +0100 @@ -22,18 +22,19 @@ * questions. */ -/* pngconf.h - machine configurable file for libpng +/* pngconf.h - machine-configurable file for libpng * * This file is available under and governed by the GNU General Public * License version 2 only, as published by the Free Software Foundation. * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * - * libpng version 1.6.35, July 15, 2018 + * libpng version 1.6.37 * + * Copyright (c) 2018-2019 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -85,14 +86,13 @@ #endif /* PNG_BUILDING_SYMBOL_TABLE */ -/* Prior to 1.6.0 it was possible to turn off 'const' in declarations using - * PNG_NO_CONST; this is no longer supported except for data declarations which - * apparently still cause problems in 2011 on some compilers. +/* Prior to 1.6.0, it was possible to turn off 'const' in declarations, + * using PNG_NO_CONST. This is no longer supported. */ #define PNG_CONST const /* backward compatibility only */ -/* This controls optimization of the reading of 16-bit and 32-bit values - * from PNG files. It can be set on a per-app-file basis - it +/* This controls optimization of the reading of 16-bit and 32-bit + * values from PNG files. It can be set on a per-app-file basis: it * just changes whether a macro is used when the function is called. * The library builder sets the default; if read functions are not * built into the library the macro implementation is forced on.
--- a/src/share/native/sun/awt/libpng/pngdebug.h Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/awt/libpng/pngdebug.h Wed Oct 23 15:35:04 2019 +0100 @@ -29,10 +29,10 @@ * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * - * Last changed in libpng 1.6.8 [December 19, 2013] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer
--- a/src/share/native/sun/awt/libpng/pngerror.c Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/awt/libpng/pngerror.c Wed Oct 23 15:35:04 2019 +0100 @@ -29,10 +29,10 @@ * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * - * Last changed in libpng 1.6.31 [July 27, 2017] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -453,7 +453,7 @@ * if the character is invalid. */ #define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97)) -static PNG_CONST char png_digit[16] = { +static const char png_digit[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; @@ -913,7 +913,7 @@ png_safe_error),(png_structp png_nonconst_ptr, png_const_charp error_message), PNG_NORETURN) { - const png_const_structrp png_ptr = png_nonconst_ptr; + png_const_structrp png_ptr = png_nonconst_ptr; png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr); /* An error is always logged here, overwriting anything (typically a warning) @@ -948,7 +948,7 @@ void /* PRIVATE */ PNGCBAPI png_safe_warning(png_structp png_nonconst_ptr, png_const_charp warning_message) { - const png_const_structrp png_ptr = png_nonconst_ptr; + png_const_structrp png_ptr = png_nonconst_ptr; png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr); /* A warning is only logged if there is no prior warning or error. */
--- a/src/share/native/sun/awt/libpng/pngget.c Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/awt/libpng/pngget.c Wed Oct 23 15:35:04 2019 +0100 @@ -29,10 +29,10 @@ * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer
--- a/src/share/native/sun/awt/libpng/pnginfo.h Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/awt/libpng/pnginfo.h Wed Oct 23 15:35:04 2019 +0100 @@ -29,10 +29,10 @@ * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2013,2018 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer
--- a/src/share/native/sun/awt/libpng/pnglibconf.h Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/awt/libpng/pnglibconf.h Wed Oct 23 15:35:04 2019 +0100 @@ -29,18 +29,16 @@ * THIS FILE WAS MODIFIED BY ORACLE, INC. */ -/* libpng STANDARD API DEFINITION */ - /* pnglibconf.h - library build configuration */ /* This file is available under and governed by the GNU General Public * License version 2 only, as published by the Free Software Foundation. * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: */ +/* libpng version 1.6.37 */ -/* libpng version 1.6.35, July 15, 2018 */ - -/* Copyright (c) 1998-2018 Glenn Randers-Pehrson */ +/* Copyright (c) 2018-2019 Cosmin Truta */ +/* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */ /* This code is released under the libpng license. */ /* For conditions of distribution and use, see the disclaimer */ @@ -80,6 +78,8 @@ #define PNG_IO_STATE_SUPPORTED #define PNG_MNG_FEATURES_SUPPORTED #define PNG_POINTER_INDEXING_SUPPORTED +/*#undef PNG_POWERPC_VSX_API_SUPPORTED*/ +/*#undef PNG_POWERPC_VSX_CHECK_SUPPORTED*/ #define PNG_PROGRESSIVE_READ_SUPPORTED #define PNG_READ_16BIT_SUPPORTED #define PNG_READ_ALPHA_MODE_SUPPORTED @@ -118,6 +118,7 @@ #define PNG_READ_USER_TRANSFORM_SUPPORTED #define PNG_READ_bKGD_SUPPORTED #define PNG_READ_cHRM_SUPPORTED +/*#undef PNG_READ_eXIf_SUPPORTED*/ #define PNG_READ_gAMA_SUPPORTED #define PNG_READ_hIST_SUPPORTED /*#undef PNG_READ_iCCP_SUPPORTED*/ @@ -187,6 +188,7 @@ /*#undef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED*/ /*#undef PNG_WRITE_bKGD_SUPPORTED*/ /*#undef PNG_WRITE_cHRM_SUPPORTED*/ +/*#undef PNG_WRITE_eXIf_SUPPORTED*/ /*#undef PNG_WRITE_gAMA_SUPPORTED*/ /*#undef PNG_WRITE_hIST_SUPPORTED*/ /*#undef PNG_WRITE_iCCP_SUPPORTED*/ @@ -204,6 +206,7 @@ /*#undef PNG_WRITE_zTXt_SUPPORTED*/ #define PNG_bKGD_SUPPORTED #define PNG_cHRM_SUPPORTED +/*#undef PNG_eXIf_SUPPORTED*/ #define PNG_gAMA_SUPPORTED #define PNG_hIST_SUPPORTED #define PNG_iCCP_SUPPORTED @@ -241,7 +244,7 @@ #define PNG_USER_HEIGHT_MAX 8000 #define PNG_USER_WIDTH_MAX 8000 #define PNG_ZBUF_SIZE 8192 -#define PNG_ZLIB_VERNUM 0 +#define PNG_ZLIB_VERNUM 0 /* unknown */ #define PNG_Z_DEFAULT_COMPRESSION (-1) #define PNG_Z_DEFAULT_NOFILTER_STRATEGY 0 #define PNG_Z_DEFAULT_STRATEGY 1
--- a/src/share/native/sun/awt/libpng/pngmem.c Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/awt/libpng/pngmem.c Wed Oct 23 15:35:04 2019 +0100 @@ -29,10 +29,10 @@ * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * - * Last changed in libpng 1.6.26 [October 20, 2016] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2014,2016 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer
--- a/src/share/native/sun/awt/libpng/pngpread.c Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/awt/libpng/pngpread.c Wed Oct 23 15:35:04 2019 +0100 @@ -29,10 +29,10 @@ * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -1000,20 +1000,20 @@ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Start of interlace block */ - static PNG_CONST png_byte png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; + static const png_byte png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; /* Offset to next interlace block */ - static PNG_CONST png_byte png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; + static const png_byte png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; /* Start of interlace block in the y direction */ - static PNG_CONST png_byte png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1}; + static const png_byte png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1}; /* Offset to next interlace block in the y direction */ - static PNG_CONST png_byte png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2}; + static const png_byte png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2}; /* Height of interlace block. This is not currently used - if you need * it, uncomment it here and in png.h - static PNG_CONST png_byte png_pass_height[] = {8, 8, 4, 4, 2, 2, 1}; + static const png_byte png_pass_height[] = {8, 8, 4, 4, 2, 2, 1}; */ #endif
--- a/src/share/native/sun/awt/libpng/pngpriv.h Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/awt/libpng/pngpriv.h Wed Oct 23 15:35:04 2019 +0100 @@ -29,10 +29,10 @@ * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018-2019 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -202,7 +202,10 @@ # else /* !defined __ARM_NEON__ */ /* The 'intrinsics' code simply won't compile without this -mfpu=neon: */ -# define PNG_ARM_NEON_IMPLEMENTATION 2 +# if !defined(__aarch64__) + /* The assembler code currently does not work on ARM64 */ +# define PNG_ARM_NEON_IMPLEMENTATION 2 +# endif /* __aarch64__ */ # endif /* __ARM_NEON__ */ # endif /* !PNG_ARM_NEON_IMPLEMENTATION */ @@ -298,6 +301,7 @@ #endif + /* Is this a build of a DLL where compilation of the object modules requires * different preprocessor settings to those required for a simple library? If * so PNG_BUILD_DLL must be set. @@ -1564,10 +1568,10 @@ #endif PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_const_structrp png_ptr, - const png_uint_32 chunk_name),PNG_EMPTY); + png_uint_32 chunk_name),PNG_EMPTY); PNG_INTERNAL_FUNCTION(void,png_check_chunk_length,(png_const_structrp png_ptr, - const png_uint_32 chunk_length),PNG_EMPTY); + png_uint_32 chunk_length),PNG_EMPTY); PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY); @@ -2144,6 +2148,29 @@ PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr, png_const_charp key, png_bytep new_key), PNG_EMPTY); +#if PNG_ARM_NEON_IMPLEMENTATION == 1 +PNG_INTERNAL_FUNCTION(void, + png_riffle_palette_neon, + (png_structrp), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(int, + png_do_expand_palette_rgba8_neon, + (png_structrp, + png_row_infop, + png_const_bytep, + const png_bytepp, + const png_bytepp), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(int, + png_do_expand_palette_rgb8_neon, + (png_structrp, + png_row_infop, + png_const_bytep, + const png_bytepp, + const png_bytepp), + PNG_EMPTY); +#endif + /* Maintainer: Put new private prototypes here ^ */ #include "pngdebug.h"
--- a/src/share/native/sun/awt/libpng/pngread.c Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/awt/libpng/pngread.c Wed Oct 23 15:35:04 2019 +0100 @@ -29,10 +29,10 @@ * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018-2019 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -1022,6 +1022,12 @@ png_ptr->chunk_list = NULL; #endif +#if defined(PNG_READ_EXPAND_SUPPORTED) && \ + defined(PNG_ARM_NEON_IMPLEMENTATION) + png_free(png_ptr, png_ptr->riffled_palette); + png_ptr->riffled_palette = NULL; +#endif + /* NOTE: the 'setjmp' buffer may still be allocated and the memory and error * callbacks are still set at this point. They are required to complete the * destruction of the png_struct itself. @@ -1649,7 +1655,7 @@ * errors (which are unfortunately quite common.) */ { - static PNG_CONST png_byte chunks_to_process[] = { + static const png_byte chunks_to_process[] = { 98, 75, 71, 68, '\0', /* bKGD */ 99, 72, 82, 77, '\0', /* cHRM */ 103, 65, 77, 65, '\0', /* gAMA */ @@ -1786,9 +1792,9 @@ png_uint_32 alpha, int encoding) { png_imagep image = display->image; - const int output_encoding = (image->format & PNG_FORMAT_FLAG_LINEAR) != 0 ? + int output_encoding = (image->format & PNG_FORMAT_FLAG_LINEAR) != 0 ? P_LINEAR : P_sRGB; - const int convert_to_Y = (image->format & PNG_FORMAT_FLAG_COLOR) == 0 && + int convert_to_Y = (image->format & PNG_FORMAT_FLAG_COLOR) == 0 && (red != green || green != blue); if (ip > 255) @@ -1897,13 +1903,13 @@ /* Store the value. */ { # ifdef PNG_FORMAT_AFIRST_SUPPORTED - const int afirst = (image->format & PNG_FORMAT_FLAG_AFIRST) != 0 && + int afirst = (image->format & PNG_FORMAT_FLAG_AFIRST) != 0 && (image->format & PNG_FORMAT_FLAG_ALPHA) != 0; # else # define afirst 0 # endif # ifdef PNG_FORMAT_BGR_SUPPORTED - const int bgr = (image->format & PNG_FORMAT_FLAG_BGR) != 0 ? 2 : 0; + int bgr = (image->format & PNG_FORMAT_FLAG_BGR) != 0 ? 2 : 0; # else # define bgr 0 # endif @@ -2113,11 +2119,11 @@ { png_image_read_control *display = png_voidcast(png_image_read_control*, argument); - const png_imagep image = display->image; - - const png_structrp png_ptr = image->opaque->png_ptr; - const png_uint_32 output_format = image->format; - const int output_encoding = (output_format & PNG_FORMAT_FLAG_LINEAR) != 0 ? + png_imagep image = display->image; + + png_structrp png_ptr = image->opaque->png_ptr; + png_uint_32 output_format = image->format; + int output_encoding = (output_format & PNG_FORMAT_FLAG_LINEAR) != 0 ? P_LINEAR : P_sRGB; unsigned int cmap_entries; @@ -2830,7 +2836,7 @@ unsigned int num_trans = png_ptr->num_trans; png_const_bytep trans = num_trans > 0 ? png_ptr->trans_alpha : NULL; png_const_colorp colormap = png_ptr->palette; - const int do_background = trans != NULL && + int do_background = trans != NULL && (output_format & PNG_FORMAT_FLAG_ALPHA) == 0; unsigned int i; @@ -3974,7 +3980,7 @@ */ if (linear != 0) { - PNG_CONST png_uint_16 le = 0x0001; + png_uint_16 le = 0x0001; if ((*(png_const_bytep) & le) != 0) png_set_swap(png_ptr); @@ -4136,7 +4142,7 @@ * original PNG format because it may not occur in the output PNG format * and libpng deals with the issues of reading the original. */ - const unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format); + unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format); /* The following checks just the 'row_stride' calculation to ensure it * fits in a signed 32-bit value. Because channels/components can be @@ -4147,7 +4153,7 @@ if (image->width <= 0x7fffffffU/channels) /* no overflow */ { png_uint_32 check; - const png_uint_32 png_row_stride = image->width * channels; + png_uint_32 png_row_stride = image->width * channels; if (row_stride == 0) row_stride = (png_int_32)/*SAFE*/png_row_stride;
--- a/src/share/native/sun/awt/libpng/pngrio.c Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/awt/libpng/pngrio.c Wed Oct 23 15:35:04 2019 +0100 @@ -29,10 +29,10 @@ * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer
--- a/src/share/native/sun/awt/libpng/pngrtran.c Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/awt/libpng/pngrtran.c Wed Oct 23 15:35:04 2019 +0100 @@ -29,10 +29,10 @@ * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018-2019 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -46,6 +46,17 @@ #include "pngpriv.h" +#ifdef PNG_ARM_NEON_IMPLEMENTATION +# if PNG_ARM_NEON_IMPLEMENTATION == 1 +# define PNG_ARM_NEON_INTRINSICS_AVAILABLE +# if defined(_MSC_VER) && defined(_M_ARM64) +# include <arm64_neon.h> +# else +# include <arm_neon.h> +# endif +# endif +#endif + #ifdef PNG_READ_SUPPORTED /* Set the action on getting a CRC error for an ancillary or critical chunk. */ @@ -1199,20 +1210,20 @@ png_ptr->palette[png_ptr->background.index].blue; #ifdef PNG_READ_INVERT_ALPHA_SUPPORTED - if ((png_ptr->transformations & PNG_INVERT_ALPHA) != 0) - { - if ((png_ptr->transformations & PNG_EXPAND_tRNS) == 0) - { - /* Invert the alpha channel (in tRNS) unless the pixels are - * going to be expanded, in which case leave it for later - */ - int i, istop = png_ptr->num_trans; - - for (i=0; i<istop; i++) - png_ptr->trans_alpha[i] = (png_byte)(255 - - png_ptr->trans_alpha[i]); - } - } + if ((png_ptr->transformations & PNG_INVERT_ALPHA) != 0) + { + if ((png_ptr->transformations & PNG_EXPAND_tRNS) == 0) + { + /* Invert the alpha channel (in tRNS) unless the pixels are + * going to be expanded, in which case leave it for later + */ + int i, istop = png_ptr->num_trans; + + for (i = 0; i < istop; i++) + png_ptr->trans_alpha[i] = + (png_byte)(255 - png_ptr->trans_alpha[i]); + } + } #endif /* READ_INVERT_ALPHA */ } } /* background expand and (therefore) no alpha association. */ @@ -3014,7 +3025,6 @@ */ static int png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row) - { int rgb_error = 0; @@ -3023,12 +3033,11 @@ if ((row_info->color_type & PNG_COLOR_MASK_PALETTE) == 0 && (row_info->color_type & PNG_COLOR_MASK_COLOR) != 0) { - PNG_CONST png_uint_32 rc = png_ptr->rgb_to_gray_red_coeff; - PNG_CONST png_uint_32 gc = png_ptr->rgb_to_gray_green_coeff; - PNG_CONST png_uint_32 bc = 32768 - rc - gc; - PNG_CONST png_uint_32 row_width = row_info->width; - PNG_CONST int have_alpha = - (row_info->color_type & PNG_COLOR_MASK_ALPHA) != 0; + png_uint_32 rc = png_ptr->rgb_to_gray_red_coeff; + png_uint_32 gc = png_ptr->rgb_to_gray_green_coeff; + png_uint_32 bc = 32768 - rc - gc; + png_uint_32 row_width = row_info->width; + int have_alpha = (row_info->color_type & PNG_COLOR_MASK_ALPHA) != 0; if (row_info->bit_depth == 8) { @@ -4171,12 +4180,11 @@ { if (row_info->bit_depth == 8) { - PNG_CONST png_bytep table = png_ptr->gamma_from_1; + png_bytep table = png_ptr->gamma_from_1; if (table != NULL) { - PNG_CONST int step = - (row_info->color_type & PNG_COLOR_MASK_COLOR) ? 4 : 2; + int step = (row_info->color_type & PNG_COLOR_MASK_COLOR) ? 4 : 2; /* The alpha channel is the last component: */ row += step - 1; @@ -4190,13 +4198,12 @@ else if (row_info->bit_depth == 16) { - PNG_CONST png_uint_16pp table = png_ptr->gamma_16_from_1; - PNG_CONST int gamma_shift = png_ptr->gamma_shift; + png_uint_16pp table = png_ptr->gamma_16_from_1; + int gamma_shift = png_ptr->gamma_shift; if (table != NULL) { - PNG_CONST int step = - (row_info->color_type & PNG_COLOR_MASK_COLOR) ? 8 : 4; + int step = (row_info->color_type & PNG_COLOR_MASK_COLOR) ? 8 : 4; /* The alpha channel is the last component: */ row += step - 2; @@ -4227,8 +4234,9 @@ * upon whether you supply trans and num_trans. */ static void -png_do_expand_palette(png_row_infop row_info, png_bytep row, - png_const_colorp palette, png_const_bytep trans_alpha, int num_trans) +png_do_expand_palette(png_structrp png_ptr, png_row_infop row_info, + png_bytep row, png_const_colorp palette, png_const_bytep trans_alpha, + int num_trans) { int shift, value; png_bytep sp, dp; @@ -4332,14 +4340,27 @@ sp = row + (size_t)row_width - 1; dp = row + ((size_t)row_width << 2) - 1; - for (i = 0; i < row_width; i++) + i = 0; +#ifdef PNG_ARM_NEON_INTRINSICS_AVAILABLE + if (png_ptr->riffled_palette != NULL) + { + /* The RGBA optimization works with png_ptr->bit_depth == 8 + * but sometimes row_info->bit_depth has been changed to 8. + * In these cases, the palette hasn't been riffled. + */ + i = png_do_expand_palette_rgba8_neon(png_ptr, row_info, row, + &sp, &dp); + } +#else + PNG_UNUSED(png_ptr) +#endif + + for (; i < row_width; i++) { if ((int)(*sp) >= num_trans) *dp-- = 0xff; - else *dp-- = trans_alpha[*sp]; - *dp-- = palette[*sp].blue; *dp-- = palette[*sp].green; *dp-- = palette[*sp].red; @@ -4356,8 +4377,15 @@ { sp = row + (size_t)row_width - 1; dp = row + (size_t)(row_width * 3) - 1; - - for (i = 0; i < row_width; i++) + i = 0; +#ifdef PNG_ARM_NEON_INTRINSICS_AVAILABLE + i = png_do_expand_palette_rgb8_neon(png_ptr, row_info, row, + &sp, &dp); +#else + PNG_UNUSED(png_ptr) +#endif + + for (; i < row_width; i++) { *dp-- = palette[*sp].blue; *dp-- = palette[*sp].green; @@ -4771,7 +4799,19 @@ { if (row_info->color_type == PNG_COLOR_TYPE_PALETTE) { - png_do_expand_palette(row_info, png_ptr->row_buf + 1, +#ifdef PNG_ARM_NEON_INTRINSICS_AVAILABLE + if ((png_ptr->num_trans > 0) && (png_ptr->bit_depth == 8)) + { + if (png_ptr->riffled_palette == NULL) + { + /* Initialize the accelerated palette expansion. */ + png_ptr->riffled_palette = + (png_bytep)png_malloc(png_ptr, 256 * 4); + png_riffle_palette_neon(png_ptr); + } + } +#endif + png_do_expand_palette(png_ptr, row_info, png_ptr->row_buf + 1, png_ptr->palette, png_ptr->trans_alpha, png_ptr->num_trans); }
--- a/src/share/native/sun/awt/libpng/pngrutil.c Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/awt/libpng/pngrutil.c Wed Oct 23 15:35:04 2019 +0100 @@ -29,10 +29,10 @@ * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -1489,8 +1489,7 @@ { /* We have the ICC profile header; do the basic header checks. */ - const png_uint_32 profile_length = - png_get_uint_32(profile_header); + png_uint_32 profile_length = png_get_uint_32(profile_header); if (png_icc_check_length(png_ptr, &png_ptr->colorspace, keyword, profile_length) != 0) @@ -1507,8 +1506,8 @@ * profile. The header check has already validated * that none of this stuff will overflow. */ - const png_uint_32 tag_count = png_get_uint_32( - profile_header+128); + png_uint_32 tag_count = + png_get_uint_32(profile_header + 128); png_bytep profile = png_read_buffer(png_ptr, profile_length, 2/*silent*/); @@ -3160,7 +3159,7 @@ */ void /* PRIVATE */ -png_check_chunk_name(png_const_structrp png_ptr, const png_uint_32 chunk_name) +png_check_chunk_name(png_const_structrp png_ptr, png_uint_32 chunk_name) { int i; png_uint_32 cn=chunk_name; @@ -3179,7 +3178,7 @@ } void /* PRIVATE */ -png_check_chunk_length(png_const_structrp png_ptr, const png_uint_32 length) +png_check_chunk_length(png_const_structrp png_ptr, png_uint_32 length) { png_alloc_size_t limit = PNG_UINT_31_MAX; @@ -3391,7 +3390,7 @@ /* Hence the pre-compiled masks indexed by PACKSWAP (or not), depth and * then pass: */ - static PNG_CONST png_uint_32 row_mask[2/*PACKSWAP*/][3/*depth*/][6] = + static const png_uint_32 row_mask[2/*PACKSWAP*/][3/*depth*/][6] = { /* Little-endian byte masks for PACKSWAP */ { S_MASKS(1,0), S_MASKS(2,0), S_MASKS(4,0) }, @@ -3402,7 +3401,7 @@ /* display_mask has only three entries for the odd passes, so index by * pass>>1. */ - static PNG_CONST png_uint_32 display_mask[2][3][3] = + static const png_uint_32 display_mask[2][3][3] = { /* Little-endian byte masks for PACKSWAP */ { B_MASKS(1,0), B_MASKS(2,0), B_MASKS(4,0) }, @@ -3715,7 +3714,7 @@ { /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Offset to next interlace block */ - static PNG_CONST unsigned int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + static const unsigned int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; png_debug(1, "in png_do_read_interlace"); if (row != NULL && row_info != NULL) @@ -4357,16 +4356,16 @@ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Start of interlace block */ - static PNG_CONST png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; + static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; /* Offset to next interlace block */ - static PNG_CONST png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; /* Start of interlace block in the y direction */ - static PNG_CONST png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; + static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; /* Offset to next interlace block in the y direction */ - static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; + static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; png_debug(1, "in png_read_finish_row"); png_ptr->row_number++; @@ -4422,16 +4421,16 @@ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Start of interlace block */ - static PNG_CONST png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; + static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; /* Offset to next interlace block */ - static PNG_CONST png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; /* Start of interlace block in the y direction */ - static PNG_CONST png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; + static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; /* Offset to next interlace block in the y direction */ - static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; + static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; unsigned int max_pixel_depth; size_t row_bytes;
--- a/src/share/native/sun/awt/libpng/pngset.c Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/awt/libpng/pngset.c Wed Oct 23 15:35:04 2019 +0100 @@ -29,10 +29,10 @@ * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2018 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -165,7 +165,7 @@ #ifdef PNG_eXIf_SUPPORTED void PNGAPI png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr, - const png_bytep eXIf_buf) + png_bytep eXIf_buf) { png_warning(png_ptr, "png_set_eXIf does not work; use png_set_eXIf_1"); PNG_UNUSED(info_ptr) @@ -174,7 +174,7 @@ void PNGAPI png_set_eXIf_1(png_const_structrp png_ptr, png_inforp info_ptr, - const png_uint_32 num_exif, const png_bytep eXIf_buf) + png_uint_32 num_exif, png_bytep eXIf_buf) { int i; @@ -1427,7 +1427,7 @@ /* Ignore all unknown chunks and all chunks recognized by * libpng except for IHDR, PLTE, tRNS, IDAT, and IEND */ - static PNG_CONST png_byte chunks_to_ignore[] = { + static const png_byte chunks_to_ignore[] = { 98, 75, 71, 68, '\0', /* bKGD */ 99, 72, 82, 77, '\0', /* cHRM */ 101, 88, 73, 102, '\0', /* eXIf */
--- a/src/share/native/sun/awt/libpng/pngstruct.h Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/awt/libpng/pngstruct.h Wed Oct 23 15:35:04 2019 +0100 @@ -29,10 +29,10 @@ * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018-2019 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -420,6 +420,12 @@ /* deleted in 1.5.5: rgb_to_gray_blue_coeff; */ #endif +/* New member added in libpng-1.6.36 */ +#if defined(PNG_READ_EXPAND_SUPPORTED) && \ + defined(PNG_ARM_NEON_IMPLEMENTATION) + png_bytep riffled_palette; /* buffer for accelerated palette expansion */ +#endif + /* New member added in libpng-1.0.4 (renamed in 1.0.9) */ #if defined(PNG_MNG_FEATURES_SUPPORTED) /* Changed from png_byte to png_uint_32 at version 1.2.0 */
--- a/src/share/native/sun/awt/libpng/pngtrans.c Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/awt/libpng/pngtrans.c Wed Oct 23 15:35:04 2019 +0100 @@ -29,10 +29,10 @@ * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -373,7 +373,7 @@ #endif #if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED) -static PNG_CONST png_byte onebppswaptable[256] = { +static const png_byte onebppswaptable[256] = { 0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0, 0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8, @@ -408,7 +408,7 @@ 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF }; -static PNG_CONST png_byte twobppswaptable[256] = { +static const png_byte twobppswaptable[256] = { 0x00, 0x40, 0x80, 0xC0, 0x10, 0x50, 0x90, 0xD0, 0x20, 0x60, 0xA0, 0xE0, 0x30, 0x70, 0xB0, 0xF0, 0x04, 0x44, 0x84, 0xC4, 0x14, 0x54, 0x94, 0xD4, @@ -443,7 +443,7 @@ 0x2F, 0x6F, 0xAF, 0xEF, 0x3F, 0x7F, 0xBF, 0xFF }; -static PNG_CONST png_byte fourbppswaptable[256] = { +static const png_byte fourbppswaptable[256] = { 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0, 0x01, 0x11, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71,
--- a/src/share/native/sun/font/DrawGlyphList.c Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/font/DrawGlyphList.c Wed Oct 23 15:35:04 2019 +0100 @@ -532,6 +532,12 @@ */ if (subPixPos && len > 0) { ginfo = (GlyphInfo*)imagePtrs[0]; + if (ginfo == NULL) { + (*env)->ReleasePrimitiveArrayCritical(env, glyphImages, + imagePtrs, JNI_ABORT); + free(gbv); + return (GlyphBlitVector*)NULL; + } /* rowBytes==width tests if its a B&W or LCD glyph */ if (ginfo->width == ginfo->rowBytes) { subPixPos = JNI_FALSE; @@ -561,6 +567,12 @@ jfloat px, py; ginfo = (GlyphInfo*)imagePtrs[g]; + if (ginfo == NULL) { + (*env)->ReleasePrimitiveArrayCritical(env, glyphImages, + imagePtrs, JNI_ABORT); + free(gbv); + return (GlyphBlitVector*)NULL; + } gbv->glyphs[g].glyphInfo = ginfo; gbv->glyphs[g].pixels = ginfo->image; gbv->glyphs[g].width = ginfo->width; @@ -636,6 +648,12 @@ } else { for (g=0; g<len; g++) { ginfo = (GlyphInfo*)imagePtrs[g]; + if (ginfo == NULL) { + (*env)->ReleasePrimitiveArrayCritical(env, glyphImages, + imagePtrs, JNI_ABORT); + free(gbv); + return (GlyphBlitVector*)NULL; + } gbv->glyphs[g].glyphInfo = ginfo; gbv->glyphs[g].pixels = ginfo->image; gbv->glyphs[g].width = ginfo->width;
--- a/src/share/native/sun/font/freetypeScaler.c Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/font/freetypeScaler.c Wed Oct 23 15:35:04 2019 +0100 @@ -29,7 +29,10 @@ #include "sunfontids.h" #include "sun_font_FreetypeFontScaler.h" -#include<stdlib.h> +#include <stdlib.h> +#if !defined(_WIN32) && !defined(__APPLE_) +#include <dlfcn.h> +#endif #include <math.h> #include "ft2build.h" #include FT_FREETYPE_H @@ -38,6 +41,7 @@ #include FT_SIZES_H #include FT_OUTLINE_H #include FT_SYNTHESIS_H +#include FT_MODULE_H #ifdef IMPROVED_FONT_RENDERING #include FT_LCD_FILTER_H #include <fontconfig/fontconfig.h> @@ -154,7 +158,31 @@ jobject bBuffer; int bread = 0; - if (numBytes == 0) return 0; + /* A call with numBytes == 0 is a seek. It should return 0 if the + * seek position is within the file and non-zero otherwise. + * For all other cases, ie numBytes !=0, return the number of bytes + * actually read. This applies to truncated reads and also failed reads. + */ + + if (numBytes == 0) { + if (offset >= scalerInfo->fileSize) { + return -1; + } else { + return 0; + } + } + + if (offset + numBytes < offset) { + return 0; // ft should not do this, but just in case. + } + + if (offset >= scalerInfo->fileSize) { + return 0; + } + + if (offset + numBytes > scalerInfo->fileSize) { + numBytes = scalerInfo->fileSize - offset; + } /* Large reads will bypass the cache and data copying */ if (numBytes > FILEDATACACHESIZE) { @@ -164,7 +192,11 @@ scalerInfo->font2D, sunFontIDs.ttReadBlockMID, bBuffer, offset, numBytes); - return bread; + if (bread < 0) { + return 0; + } else { + return bread; + } } else { /* We probably hit bug bug 4845371. For reasons that * are currently unclear, the call stacks after the initial @@ -179,9 +211,18 @@ (*env)->CallObjectMethod(env, scalerInfo->font2D, sunFontIDs.ttReadBytesMID, offset, numBytes); - (*env)->GetByteArrayRegion(env, byteArray, - 0, numBytes, (jbyte*)destBuffer); - return numBytes; + /* If there's an OutofMemoryError then byteArray will be null */ + if (byteArray == NULL) { + return 0; + } else { + jsize len = (*env)->GetArrayLength(env, byteArray); + if (len < numBytes) { + numBytes = len; // don't get more bytes than there are .. + } + (*env)->GetByteArrayRegion(env, byteArray, + 0, numBytes, (jbyte*)destBuffer); + return numBytes; + } } } /* Do we have a cache hit? */ else if (scalerInfo->fontDataOffset <= offset && @@ -203,11 +244,62 @@ sunFontIDs.ttReadBlockMID, bBuffer, offset, scalerInfo->fontDataLength); + if (bread <= 0) { + return 0; + } else if (bread < numBytes) { + numBytes = bread; + } memcpy(destBuffer, scalerInfo->fontData, numBytes); return numBytes; } } +typedef FT_Error (*FT_Prop_Set_Func)(FT_Library library, + const FT_String* module_name, + const FT_String* property_name, + const void* value ); + +/** + * Prefer the older v35 freetype byte code interpreter. + */ +static void setInterpreterVersion(FT_Library library) { + + char* props = getenv("FREETYPE_PROPERTIES"); + int version = 35; + const char* module = "truetype"; + const char* property = "interpreter-version"; + + /* If some one is setting this, don't override it */ + if (props != NULL && strstr(property, props)) { + return; + } + /* + * FT_Property_Set was introduced in 2.4.11. + * Some older supported Linux OSes may not include it so look + * this up dynamically. + * And if its not available it doesn't matter, since the reason + * we need it dates from 2.7. + * On Windows & Mac the library is always bundled so it is safe + * to use directly in those cases. + */ +#if defined(_WIN32) || defined(__APPLE__) + FT_Property_Set(library, module, property, (void*)(&version)); +#else + void *lib = dlopen("libfreetype.so", RTLD_LOCAL|RTLD_LAZY); + if (lib == NULL) { + lib = dlopen("libfreetype.so.6", RTLD_LOCAL|RTLD_LAZY); + if (lib == NULL) { + return; + } + } + FT_Prop_Set_Func func = (FT_Prop_Set_Func)dlsym(lib, "FT_Property_Set"); + if (func != NULL) { + func(library, module, property, (void*)(&version)); + } + dlclose(lib); +#endif +} + /* * Class: sun_font_FreetypeFontScaler * Method: initNativeScaler @@ -247,6 +339,7 @@ free(scalerInfo); return 0; } + setInterpreterVersion(scalerInfo->library); #define TYPE1_FROM_JAVA 2 @@ -533,16 +626,17 @@ to avoid unnecesary work with bitmaps. */ GlyphInfo *info; - jfloat advance; + jfloat advance = 0.0f; jlong image; image = Java_sun_font_FreetypeFontScaler_getGlyphImageNative( env, scaler, font2D, pScalerContext, pScaler, glyphCode); info = (GlyphInfo*) jlong_to_ptr(image); - advance = info->advanceX; - - free(info); + if (info != NULL) { + advance = info->advanceX; + free(info); + } return advance; } @@ -836,6 +930,13 @@ } #endif +/* JDK does not use glyph images for fonts with a + * pixel size > 100 (see THRESHOLD in OutlineTextRenderer.java) + * so if the glyph bitmap image dimension is > 1024 pixels, + * something is up. + */ +#define MAX_GLYPH_DIM 1024 + /* * Class: sun_font_FreetypeFontScaler * Method: getGlyphImageNative @@ -934,12 +1035,29 @@ FT_Render_Glyph(ftglyph, renderingProperties.ftRenderMode); #else if (ftglyph->format == FT_GLYPH_FORMAT_OUTLINE) { - FT_Render_Glyph(ftglyph, FT_LOAD_TARGET_MODE(target)); + FT_BBox bbox; + int w, h; + FT_Outline_Get_CBox(&(ftglyph->outline), &bbox); + w = (int)((bbox.xMax>>6)-(bbox.xMin>>6)); + h = (int)((bbox.yMax>>6)-(bbox.yMin>>6)); + if (w > MAX_GLYPH_DIM || h > MAX_GLYPH_DIM) { + glyphInfo = getNullGlyphImage(); + return ptr_to_jlong(glyphInfo); + } + error = FT_Render_Glyph(ftglyph, FT_LOAD_TARGET_MODE(target)); + if (error != 0) { + return ptr_to_jlong(getNullGlyphImage()); + } } #endif width = (UInt16) ftglyph->bitmap.width; height = (UInt16) ftglyph->bitmap.rows; + if (width > MAX_GLYPH_DIM || height > MAX_GLYPH_DIM) { + glyphInfo = getNullGlyphImage(); + return ptr_to_jlong(glyphInfo); + } + imageSize = width*height; glyphInfo = (GlyphInfo*) malloc(sizeof(GlyphInfo) + imageSize);
--- a/src/share/native/sun/font/layout/AlternateSubstSubtables.cpp Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/font/layout/AlternateSubstSubtables.cpp Wed Oct 23 15:35:04 2019 +0100 @@ -42,6 +42,10 @@ le_uint32 AlternateSubstitutionSubtable::process(const LEReferenceTo<AlternateSubstitutionSubtable> &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter) const { + if (LE_FAILURE(success)) { + return 0; + } + // NOTE: For now, we'll just pick the first alternative... LEGlyphID glyph = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(base, glyph, success);
--- a/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp Wed Oct 23 15:35:04 2019 +0100 @@ -41,6 +41,10 @@ le_uint32 CursiveAttachmentSubtable::process(const LEReferenceTo<CursiveAttachmentSubtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const { + if (LE_FAILURE(success)) { + return 0; + } + LEGlyphID glyphID = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(base, glyphID, success); le_uint16 eeCount = SWAPW(entryExitCount);
--- a/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp Wed Oct 23 15:35:04 2019 +0100 @@ -42,6 +42,10 @@ le_uint32 LigatureSubstitutionSubtable::process(const LETableReference &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter) const { + if (LE_FAILURE(success)) { + return 0; + } + LEGlyphID glyph = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(base, glyph, success);
--- a/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp Wed Oct 23 15:35:04 2019 +0100 @@ -53,6 +53,10 @@ le_int32 MarkToBasePositioningSubtable::process(const LETableReference &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const { + if (LE_FAILURE(success)) { + return 0; + } + LEGlyphID markGlyph = glyphIterator->getCurrGlyphID(); le_int32 markCoverage = getGlyphCoverage(base, (LEGlyphID) markGlyph, success);
--- a/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp Wed Oct 23 15:35:04 2019 +0100 @@ -52,6 +52,10 @@ le_int32 MarkToLigaturePositioningSubtable::process(const LETableReference &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const { + if (LE_FAILURE(success)) { + return 0; + } + LEGlyphID markGlyph = glyphIterator->getCurrGlyphID(); le_int32 markCoverage = getGlyphCoverage(base, (LEGlyphID) markGlyph, success);
--- a/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp Wed Oct 23 15:35:04 2019 +0100 @@ -53,6 +53,10 @@ le_int32 MarkToMarkPositioningSubtable::process(const LETableReference &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const { + if (LE_FAILURE(success)) { + return 0; + } + LEGlyphID markGlyph = glyphIterator->getCurrGlyphID(); le_int32 markCoverage = getGlyphCoverage(base, (LEGlyphID) markGlyph, success);
--- a/src/share/native/sun/font/layout/MorphTables.cpp Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/font/layout/MorphTables.cpp Wed Oct 23 15:35:04 2019 +0100 @@ -46,8 +46,10 @@ void MorphTableHeader::process(const LETableReference &base, LEGlyphStorage &glyphStorage, LEErrorCode &success) const { - le_uint32 chainCount = SWAPL(this->nChains); - LEReferenceTo<ChainHeader> chainHeader(base, success, chains); // moving header + if (LE_FAILURE(success)) return; + + le_uint32 chainCount = SWAPL(this->nChains); + LEReferenceTo<ChainHeader> chainHeader(base, success, chains); // moving header LEReferenceToArrayOf<ChainHeader> chainHeaderArray(base, success, chains, chainCount); le_uint32 chain;
--- a/src/share/native/sun/font/layout/PairPositioningSubtables.cpp Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/font/layout/PairPositioningSubtables.cpp Wed Oct 23 15:35:04 2019 +0100 @@ -43,6 +43,10 @@ le_uint32 PairPositioningSubtable::process(const LEReferenceTo<PairPositioningSubtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const { + if (LE_FAILURE(success)) { + return 0; + } + switch(SWAPW(subtableFormat)) { case 0: @@ -74,6 +78,10 @@ le_uint32 PairPositioningFormat1Subtable::process(const LEReferenceTo<PairPositioningFormat1Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const { + if (LE_FAILURE(success)) { + return 0; + } + LEGlyphID firstGlyph = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(base, firstGlyph, success); GlyphIterator tempIterator(*glyphIterator); @@ -123,6 +131,10 @@ le_uint32 PairPositioningFormat2Subtable::process(const LEReferenceTo<PairPositioningFormat2Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const { + if (LE_FAILURE(success)) { + return 0; + } + LEGlyphID firstGlyph = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(base, firstGlyph, success);
--- a/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp Wed Oct 23 15:35:04 2019 +0100 @@ -59,6 +59,8 @@ void SegmentArrayProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) { + if (LE_FAILURE(success)) return; + const LookupSegment *segments = segmentArrayLookupTable->segments; le_int32 glyphCount = glyphStorage.getGlyphCount(); le_int32 glyph;
--- a/src/share/native/sun/font/layout/SegmentArrayProcessor2.cpp Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/font/layout/SegmentArrayProcessor2.cpp Wed Oct 23 15:35:04 2019 +0100 @@ -59,6 +59,8 @@ void SegmentArrayProcessor2::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) { + if (LE_FAILURE(success)) return; + const LookupSegment *segments = segmentArrayLookupTable->segments; le_int32 glyphCount = glyphStorage.getGlyphCount(); le_int32 glyph;
--- a/src/share/native/sun/font/layout/SegmentSingleProcessor.cpp Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/font/layout/SegmentSingleProcessor.cpp Wed Oct 23 15:35:04 2019 +0100 @@ -59,6 +59,8 @@ void SegmentSingleProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) { + if (LE_FAILURE(success)) return; + const LookupSegment *segments = segmentSingleLookupTable->segments; le_int32 glyphCount = glyphStorage.getGlyphCount(); le_int32 glyph;
--- a/src/share/native/sun/font/layout/SegmentSingleProcessor2.cpp Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/font/layout/SegmentSingleProcessor2.cpp Wed Oct 23 15:35:04 2019 +0100 @@ -60,6 +60,8 @@ void SegmentSingleProcessor2::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) { + if (LE_FAILURE(success)) return; + const LookupSegment *segments = segmentSingleLookupTable->segments; le_int32 glyphCount = glyphStorage.getGlyphCount(); le_int32 glyph;
--- a/src/share/native/sun/font/layout/SimpleArrayProcessor.cpp Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/font/layout/SimpleArrayProcessor.cpp Wed Oct 23 15:35:04 2019 +0100 @@ -59,6 +59,8 @@ void SimpleArrayProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) { + if (LE_FAILURE(success)) return; + le_int32 glyphCount = glyphStorage.getGlyphCount(); le_int32 glyph;
--- a/src/share/native/sun/font/layout/SinglePositioningSubtables.cpp Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/font/layout/SinglePositioningSubtables.cpp Wed Oct 23 15:35:04 2019 +0100 @@ -42,6 +42,10 @@ le_uint32 SinglePositioningSubtable::process(const LEReferenceTo<SinglePositioningSubtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const { + if (LE_FAILURE(success)) { + return 0; + } + switch(SWAPW(subtableFormat)) { case 0: @@ -68,6 +72,10 @@ le_uint32 SinglePositioningFormat1Subtable::process(const LEReferenceTo<SinglePositioningFormat1Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const { + if (LE_FAILURE(success)) { + return 0; + } + LEGlyphID glyph = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(base, glyph, success); if (LE_FAILURE(success)) { @@ -85,6 +93,10 @@ le_uint32 SinglePositioningFormat2Subtable::process(const LEReferenceTo<SinglePositioningFormat2Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const { + if (LE_FAILURE(success)) { + return 0; + } + LEGlyphID glyph = glyphIterator->getCurrGlyphID(); le_int16 coverageIndex = (le_int16) getGlyphCoverage(base, glyph, success); if (LE_FAILURE(success)) {
--- a/src/share/native/sun/font/layout/SingleSubstitutionSubtables.cpp Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/font/layout/SingleSubstitutionSubtables.cpp Wed Oct 23 15:35:04 2019 +0100 @@ -41,6 +41,10 @@ le_uint32 SingleSubstitutionSubtable::process(const LEReferenceTo<SingleSubstitutionSubtable> &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter) const { + if (LE_FAILURE(success)) { + return 0; + } + switch(SWAPW(subtableFormat)) { case 0: @@ -67,6 +71,10 @@ le_uint32 SingleSubstitutionFormat1Subtable::process(const LEReferenceTo<SingleSubstitutionFormat1Subtable> &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter) const { + if (LE_FAILURE(success)) { + return 0; + } + LEGlyphID glyph = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(base, glyph, success); if (LE_FAILURE(success)) { @@ -88,6 +96,10 @@ le_uint32 SingleSubstitutionFormat2Subtable::process(const LEReferenceTo<SingleSubstitutionFormat2Subtable> &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter) const { + if (LE_FAILURE(success)) { + return 0; + } + LEGlyphID glyph = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(base, glyph, success); if (LE_FAILURE(success)) {
--- a/src/share/native/sun/font/layout/SingleTableProcessor.cpp Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/font/layout/SingleTableProcessor.cpp Wed Oct 23 15:35:04 2019 +0100 @@ -59,6 +59,8 @@ void SingleTableProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) { + if (LE_FAILURE(success)) return; + const LookupSingle *entries = singleTableLookupTable->entries; le_int32 glyph; le_int32 glyphCount = glyphStorage.getGlyphCount();
--- a/src/share/native/sun/java2d/cmm/lcms/cmsxform.c Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/cmsxform.c Wed Oct 23 15:35:04 2019 +0100 @@ -836,7 +836,7 @@ // Save the day? (Ignore the warning) if (Plugin->OldXform) { - p->OldXform = (_cmsTransformFn) p->xform; + p->OldXform = (_cmsTransformFn)(void*) p->xform; p->xform = _cmsTransform2toTransformAdaptor; }
--- a/src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h Wed Oct 23 15:35:04 2019 +0100 @@ -489,6 +489,8 @@ #define PtrCoord(p, x, xinc, y, yinc) PtrAddBytes(p, \ ((ptrdiff_t)(y))*(yinc) + \ ((ptrdiff_t)(x))*(xinc)) +#define PtrPixelsRow(p, y, scanStride) PtrAddBytes(p, \ + ((intptr_t) (y)) * (scanStride)) /* * The function to call with an array of NativePrimitive structures
--- a/src/share/native/sun/java2d/loops/LoopMacros.h Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/java2d/loops/LoopMacros.h Wed Oct 23 15:35:04 2019 +0100 @@ -137,7 +137,7 @@ do { \ juint w = WIDTH; \ jint tmpsxloc = SXLOC; \ - SRCPTR = PtrAddBytes(SRCBASE, ((SYLOC >> SHIFT) * srcScan)); \ + SRCPTR = PtrPixelsRow(SRCBASE, (SYLOC >> SHIFT), srcScan); \ Init ## DSTTYPE ## StoreVarsX(DSTPREFIX, DSTINFO); \ do { \ jint XVAR = (tmpsxloc >> SHIFT); \ @@ -2015,7 +2015,7 @@ \ Init ## SRC ## LoadVars(SrcRead, pSrcInfo); \ while (pRGB < pEnd) { \ - SRC ## DataType *pRow = PtrAddBytes(pBase, WholeOfLong(ylong) * scan); \ + SRC ## DataType *pRow = PtrPixelsRow(pBase, WholeOfLong(ylong), scan); \ Copy ## SRC ## ToIntArgbPre(pRGB, 0, \ SrcRead, pRow, WholeOfLong(xlong)); \ pRGB++; \ @@ -2063,7 +2063,7 @@ ydelta &= scan; \ \ xwhole += cx; \ - pRow = PtrAddBytes(pSrcInfo->rasBase, (ywhole + cy) * scan); \ + pRow = PtrPixelsRow(pSrcInfo->rasBase, (ywhole + cy), scan); \ Copy ## SRC ## ToIntArgbPre(pRGB, 0, SrcRead, pRow, xwhole); \ Copy ## SRC ## ToIntArgbPre(pRGB, 1, SrcRead, pRow, xwhole+xdelta); \ pRow = PtrAddBytes(pRow, ydelta); \ @@ -2121,7 +2121,7 @@ ydelta1 += (isneg & -scan); \ \ xwhole += cx; \ - pRow = PtrAddBytes(pSrcInfo->rasBase, (ywhole + cy) * scan); \ + pRow = PtrPixelsRow(pSrcInfo->rasBase, (ywhole + cy), scan); \ pRow = PtrAddBytes(pRow, ydelta0); \ Copy ## SRC ## ToIntArgbPre(pRGB, 0, SrcRead, pRow, xwhole+xdelta0); \ Copy ## SRC ## ToIntArgbPre(pRGB, 1, SrcRead, pRow, xwhole ); \
--- a/src/share/native/sun/java2d/opengl/OGLBlitLoops.c Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/java2d/opengl/OGLBlitLoops.c Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, 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 @@ -180,6 +180,7 @@ jdouble dx1, jdouble dy1, jdouble dx2, jdouble dy2) { GLfloat scalex, scaley; + GLvoid *pSrc; scalex = ((GLfloat)(dx2-dx1)) / (sx2-sx1); scaley = ((GLfloat)(dy2-dy1)) / (sy2-sy1); @@ -208,21 +209,22 @@ j2d_glPixelZoom(scalex, -scaley); + pSrc = PtrCoord(srcInfo->rasBase, sx1, srcInfo->pixelStride, + sy1, srcInfo->scanStride); + // in case pixel stride is not a multiple of scanline stride the copy // has to be done line by line (see 6207877) if (srcInfo->scanStride % srcInfo->pixelStride != 0) { jint width = sx2-sx1; jint height = sy2-sy1; - GLvoid *pSrc = srcInfo->rasBase; - while (height > 0) { j2d_glDrawPixels(width, 1, pf->format, pf->type, pSrc); - j2d_glBitmap(0, 0, 0, 0, (GLfloat)0, (GLfloat)-1, NULL); + j2d_glBitmap(0, 0, 0, 0, (GLfloat)0, (GLfloat)-scaley, NULL); pSrc = PtrAddBytes(pSrc, srcInfo->scanStride); height--; } } else { - j2d_glDrawPixels(sx2-sx1, sy2-sy1, pf->format, pf->type, srcInfo->rasBase); + j2d_glDrawPixels(sx2-sx1, sy2-sy1, pf->format, pf->type, pSrc); } j2d_glPixelZoom(1.0, 1.0); @@ -317,12 +319,11 @@ ty2 = ((GLdouble)sh) / th; if (swsurface) { + GLvoid *pSrc = PtrCoord(srcInfo->rasBase, + sx, srcInfo->pixelStride, + sy, srcInfo->scanStride); if (slowPath) { jint tmph = sh; - GLvoid *pSrc = PtrCoord(srcInfo->rasBase, - sx, srcInfo->pixelStride, - sy, srcInfo->scanStride); - while (tmph > 0) { j2d_glTexSubImage2D(GL_TEXTURE_2D, 0, 0, sh - tmph, sw, 1, @@ -332,16 +333,10 @@ tmph--; } } else { - j2d_glPixelStorei(GL_UNPACK_SKIP_PIXELS, sx); - j2d_glPixelStorei(GL_UNPACK_SKIP_ROWS, sy); - j2d_glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, sw, sh, pf->format, pf->type, - srcInfo->rasBase); - - j2d_glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); - j2d_glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); + pSrc); } // the texture image is "right side up", so we align the @@ -638,8 +633,9 @@ J2dTraceLn4(J2D_TRACE_VERBOSE, " dx1=%f dy1=%f dx2=%f dy2=%f", dx1, dy1, dx2, dy2); - j2d_glPixelStorei(GL_UNPACK_SKIP_PIXELS, sx1); - j2d_glPixelStorei(GL_UNPACK_SKIP_ROWS, sy1); + // Note: we will calculate x/y positions in the raster manually + j2d_glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); + j2d_glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); j2d_glPixelStorei(GL_UNPACK_ROW_LENGTH, srcInfo.scanStride / srcInfo.pixelStride); j2d_glPixelStorei(GL_UNPACK_ALIGNMENT, pf.alignment); @@ -696,8 +692,6 @@ } } - j2d_glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); - j2d_glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); j2d_glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); j2d_glPixelStorei(GL_UNPACK_ALIGNMENT, 4); } @@ -717,8 +711,8 @@ juint step = 0; // vertical flip and convert argbpre to argb if necessary for (; i < h / 2; ++i) { - juint *r1 = PtrAddBytes(pDst, (i * scanStride)); - juint *r2 = PtrAddBytes(pDst, (h - i - 1) * scanStride); + juint *r1 = PtrPixelsRow(pDst, i, scanStride); + juint *r2 = PtrPixelsRow(pDst, h - i - 1, scanStride); if (tempRow) { // fast path memcpy(tempRow, r1, clippedStride); @@ -740,7 +734,7 @@ } // convert the middle line if necessary if (convert && h % 2) { - juint *r1 = PtrAddBytes(pDst, (i * scanStride)); + juint *r1 = PtrPixelsRow(pDst, i, scanStride); for (step = 0; step < w; ++step) { LoadIntArgbPreTo1IntArgb(r1, 0, step, r1[step]); } @@ -813,7 +807,7 @@ height = srcInfo.bounds.y2 - srcInfo.bounds.y1; pDst = PtrAddBytes(pDst, dstx * dstInfo.pixelStride); - pDst = PtrAddBytes(pDst, dsty * dstInfo.scanStride); + pDst = PtrPixelsRow(pDst, dsty, dstInfo.scanStride); j2d_glPixelStorei(GL_PACK_ROW_LENGTH, dstInfo.scanStride / dstInfo.pixelStride);
--- a/src/share/native/sun/security/ec/impl/ec.c Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/security/ec/impl/ec.c Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * * This library is free software; you can redistribute it and/or @@ -659,6 +659,7 @@ SECItem kGpoint = { siBuffer, NULL, 0}; int flen = 0; /* length in bytes of the field size */ unsigned olen; /* length in bytes of the base point order */ + unsigned int orderBitSize; #if EC_DEBUG char mpstr[256]; @@ -761,10 +762,11 @@ SECITEM_TO_MPINT(*digest, &s); /* s = HASH(M) */ /* In the definition of EC signing, digests are truncated - * to the length of n in bits. + * to the order length * (see SEC 1 "Elliptic Curve Digit Signature Algorithm" section 4.1.*/ - if (digest->len*8 > (unsigned int)ecParams->fieldID.size) { - mpl_rsh(&s,&s,digest->len*8 - ecParams->fieldID.size); + orderBitSize = mpl_significant_bits(&n); + if (digest->len*8 > orderBitSize) { + mpl_rsh(&s,&s,digest->len*8 - orderBitSize); } #if EC_DEBUG @@ -897,6 +899,7 @@ int slen; /* length in bytes of a half signature (r or s) */ int flen; /* length in bytes of the field size */ unsigned olen; /* length in bytes of the base point order */ + unsigned int orderBitSize; #if EC_DEBUG char mpstr[256]; @@ -976,11 +979,12 @@ SECITEM_TO_MPINT(*digest, &u1); /* u1 = HASH(M) */ /* In the definition of EC signing, digests are truncated - * to the length of n in bits. + * to the order length, in bits. * (see SEC 1 "Elliptic Curve Digit Signature Algorithm" section 4.1.*/ /* u1 = HASH(M') */ - if (digest->len*8 > (unsigned int)ecParams->fieldID.size) { - mpl_rsh(&u1,&u1,digest->len*8- ecParams->fieldID.size); + orderBitSize = mpl_significant_bits(&n); + if (digest->len*8 > orderBitSize) { + mpl_rsh(&u1,&u1,digest->len*8- orderBitSize); } #if EC_DEBUG
--- a/src/share/native/sun/security/krb5/nativeccache.c Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/security/krb5/nativeccache.c Wed Oct 23 15:35:04 2019 +0100 @@ -291,6 +291,7 @@ int netypes; jint *etypes = NULL; + int proxy_flag = 0; /* Initialize the Kerberos 5 context */ err = krb5_init_context (&kcontext); @@ -303,6 +304,48 @@ err = krb5_cc_set_flags (kcontext, ccache, flags); /* turn off OPENCLOSE */ } + // First round read. The proxy_impersonator config flag is not supported. + // This ccache will not be used if this flag exists. + if (!err) { + err = krb5_cc_start_seq_get (kcontext, ccache, &cursor); + } + + if (!err) { + while ((err = krb5_cc_next_cred (kcontext, ccache, &cursor, &creds)) == 0) { + char *serverName = NULL; + + if (!err) { + err = krb5_unparse_name (kcontext, creds.server, &serverName); + printiferr (err, "while unparsing server name"); + } + + if (!err) { + if (!strcmp(serverName, "krb5_ccache_conf_data/proxy_impersonator@X-CACHECONF:")) { + proxy_flag = 1; + } + } + + if (serverName != NULL) { krb5_free_unparsed_name (kcontext, serverName); } + + krb5_free_cred_contents (kcontext, &creds); + + if (proxy_flag) break; + } + + if (err == KRB5_CC_END) { err = 0; } + printiferr (err, "while retrieving a ticket"); + } + + if (!err) { + err = krb5_cc_end_seq_get (kcontext, ccache, &cursor); + printiferr (err, "while finishing ticket retrieval"); + } + + if (proxy_flag) { + goto outer_cleanup; + } + // End of first round read + if (!err) { err = krb5_cc_start_seq_get (kcontext, ccache, &cursor); } @@ -430,6 +473,7 @@ printiferr (err, "while finishing ticket retrieval"); } +outer_cleanup: if (!err) { flags = KRB5_TC_OPENCLOSE; /* restore OPENCLOSE mode */ err = krb5_cc_set_flags (kcontext, ccache, flags);
--- a/src/share/native/sun/security/pkcs11/wrapper/p11_keymgmt.c Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/security/pkcs11/wrapper/p11_keymgmt.c Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 2002 Graz University of Technology. All rights reserved. @@ -151,14 +151,14 @@ unsigned int i = 0U; unsigned long totalDataSize = 0UL, attributesCount = 0UL; unsigned long totalCkAttributesSize = 0UL, totalNativeKeyInfoArraySize = 0UL; - unsigned long* wrappedKeySizePtr = NULL; + jbyte* wrappedKeySizePtr = NULL; jbyte* nativeKeyInfoArrayRawCkAttributes = NULL; jbyte* nativeKeyInfoArrayRawCkAttributesPtr = NULL; jbyte* nativeKeyInfoArrayRawDataPtr = NULL; CK_MECHANISM ckMechanism; char iv[16] = {0x0}; CK_ULONG ckWrappedKeyLength = 0U; - unsigned long* wrappedKeySizeWrappedKeyArrayPtr = NULL; + jbyte* wrappedKeySizeWrappedKeyArrayPtr = NULL; CK_BYTE_PTR wrappedKeyBufferPtr = NULL; CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj); CK_OBJECT_CLASS class; @@ -234,7 +234,7 @@ // * sizes are expressed in bytes and data type is unsigned long totalCkAttributesSize = attributesCount * sizeof(CK_ATTRIBUTE); TRACE1("DEBUG: GetNativeKeyInfo attributesCount = %lu\n", attributesCount); - TRACE1("DEBUG: GetNativeKeyInfo sizeof CK_ATTRIBUTE = %lu\n", sizeof(CK_ATTRIBUTE)); + TRACE1("DEBUG: GetNativeKeyInfo sizeof CK_ATTRIBUTE = %zu\n", sizeof(CK_ATTRIBUTE)); TRACE1("DEBUG: GetNativeKeyInfo totalCkAttributesSize = %lu\n", totalCkAttributesSize); TRACE1("DEBUG: GetNativeKeyInfo totalDataSize = %lu\n", totalDataSize); @@ -254,8 +254,8 @@ goto cleanup; } - wrappedKeySizePtr = (unsigned long*)(nativeKeyInfoArrayRaw + - sizeof(unsigned long)*2 + totalCkAttributesSize + totalDataSize); + wrappedKeySizePtr = nativeKeyInfoArrayRaw + + sizeof(unsigned long)*2 + totalCkAttributesSize + totalDataSize; memcpy(nativeKeyInfoArrayRaw, &totalCkAttributesSize, sizeof(unsigned long)); memcpy(nativeKeyInfoArrayRaw + sizeof(unsigned long) + totalCkAttributesSize, @@ -308,7 +308,7 @@ *(CK_BBOOL*)(((CK_ATTRIBUTE_PTR)(((CK_ATTRIBUTE_PTR)nativeKeyInfoArrayRawCkAttributes) +sensitiveAttributePosition))->pValue) == CK_TRUE) { // Key is sensitive. Need to extract it wrapped. - if (jWrappingKeyHandle != -1) { + if (jWrappingKeyHandle != 0) { jMechanismToCKMechanism(env, jWrappingMech, &ckMechanism); rv = (*ckpFunctions->C_WrapKey)(ckSessionHandle, &ckMechanism, @@ -330,15 +330,15 @@ memcpy(nativeKeyInfoWrappedKeyArrayRaw, nativeKeyInfoArrayRaw, totalNativeKeyInfoArraySize); wrappedKeySizeWrappedKeyArrayPtr = - (unsigned long*)(nativeKeyInfoWrappedKeyArrayRaw + + nativeKeyInfoWrappedKeyArrayRaw + sizeof(unsigned long)*2 + totalCkAttributesSize + - totalDataSize); + totalDataSize; memcpy(wrappedKeySizeWrappedKeyArrayPtr, &ckWrappedKeyLength, sizeof(unsigned long)); TRACE1("DEBUG: GetNativeKeyInfo 1st C_WrapKey wrappedKeyLength = %lu\n", ckWrappedKeyLength); wrappedKeyBufferPtr = - (unsigned char*)wrappedKeySizeWrappedKeyArrayPtr + - sizeof(unsigned long); + (CK_BYTE_PTR) (wrappedKeySizeWrappedKeyArrayPtr + + sizeof(unsigned long)); rv = (*ckpFunctions->C_WrapKey)(ckSessionHandle, &ckMechanism, jLongToCKULong(jWrappingKeyHandle),ckObjectHandle, wrappedKeyBufferPtr, &ckWrappedKeyLength); @@ -351,6 +351,7 @@ goto cleanup; } } else { + ckAssertReturnValueOK(env, CKR_KEY_HANDLE_INVALID); goto cleanup; } returnValue = nativeKeyInfoWrappedKeyArray; @@ -414,7 +415,7 @@ jbyte* nativeKeyInfoArrayRawCkAttributesPtr = NULL; jbyte* nativeKeyInfoArrayRawDataPtr = NULL; unsigned long totalDataSize = 0UL; - unsigned long* wrappedKeySizePtr = NULL; + jbyte* wrappedKeySizePtr = NULL; unsigned int i = 0U; CK_MECHANISM ckMechanism; char iv[16] = {0x0}; @@ -443,8 +444,8 @@ sizeof(unsigned long)); TRACE1("DEBUG: createNativeKey totalDataSize = %lu\n", totalDataSize); - wrappedKeySizePtr = (unsigned long*)(nativeKeyInfoArrayRaw + - sizeof(unsigned long)*2 + totalCkAttributesSize + totalDataSize); + wrappedKeySizePtr = nativeKeyInfoArrayRaw + + sizeof(unsigned long)*2 + totalCkAttributesSize + totalDataSize; memcpy(&ckWrappedKeyLength, wrappedKeySizePtr, sizeof(unsigned long)); TRACE1("DEBUG: createNativeKey wrappedKeyLength = %lu\n", ckWrappedKeyLength); @@ -470,7 +471,8 @@ jMechanismToCKMechanism(env, jWrappingMech, &ckMechanism); rv = (*ckpFunctions->C_UnwrapKey)(ckSessionHandle, &ckMechanism, jLongToCKULong(jWrappingKeyHandle), - (CK_BYTE_PTR)(wrappedKeySizePtr + 1), ckWrappedKeyLength, + (CK_BYTE_PTR)(wrappedKeySizePtr + sizeof(unsigned long)), + ckWrappedKeyLength, (CK_ATTRIBUTE_PTR)nativeKeyInfoArrayRawCkAttributes, jLongToCKULong(nativeKeyInfoCkAttributesCount), &ckObjectHandle);
--- a/src/share/native/sun/security/smartcardio/pcsc.c Mon Sep 09 17:27:04 2019 +0100 +++ b/src/share/native/sun/security/smartcardio/pcsc.c Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2019, 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 @@ -179,7 +179,7 @@ { SCARDCONTEXT context = (SCARDCONTEXT)jContext; LONG rv; - LPTSTR mszReaders = NULL; + LPSTR mszReaders = NULL; DWORD size = 0; jobjectArray result; @@ -216,7 +216,7 @@ { SCARDCONTEXT context = (SCARDCONTEXT)jContext; LONG rv; - LPCTSTR readerName; + LPCSTR readerName; SCARDHANDLE card = 0; DWORD proto = 0;
--- a/src/solaris/classes/sun/font/XRGlyphCache.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/solaris/classes/sun/font/XRGlyphCache.java Wed Oct 23 15:35:04 2019 +0100 @@ -114,6 +114,9 @@ for (int i = 0; i < glyphList.getNumGlyphs(); i++) { XRGlyphCacheEntry glyph; + if (imgPtrs[i] == 0L) { + continue; + } // Find uncached glyphs and queue them for upload if ((glyph = getEntryForPointer(imgPtrs[i])) == null) { glyph = new XRGlyphCacheEntry(imgPtrs[i], glyphList);
--- a/src/solaris/classes/sun/font/XRTextRenderer.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/solaris/classes/sun/font/XRTextRenderer.java Wed Oct 23 15:35:04 2019 +0100 @@ -88,6 +88,9 @@ for (int i = 0; i < gl.getNumGlyphs(); i++) { gl.setGlyphIndex(i); XRGlyphCacheEntry cacheEntry = cachedGlyphs[i]; + if (cacheEntry == null) { + continue; + } eltList.getGlyphs().addInt(cacheEntry.getGlyphID()); int glyphSet = cacheEntry.getGlyphSet();
--- a/src/solaris/classes/sun/nio/ch/UnixAsynchronousSocketChannelImpl.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/solaris/classes/sun/nio/ch/UnixAsynchronousSocketChannelImpl.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 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 @@ -269,6 +269,7 @@ // invoke handler and set result CompletionHandler<Void,Object> handler = connectHandler; + connectHandler = null; Object att = connectAttachment; PendingFuture<Void,Object> future = connectFuture; if (handler == null) { @@ -398,6 +399,7 @@ this.readBuffer = null; this.readBuffers = null; this.readAttachment = null; + this.readHandler = null; // allow another read to be initiated enableReading(); @@ -593,6 +595,7 @@ this.writeBuffer = null; this.writeBuffers = null; this.writeAttachment = null; + this.writeHandler = null; // allow another write to be initiated enableWriting();
--- a/src/solaris/classes/sun/nio/fs/BsdFileStore.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/solaris/classes/sun/nio/fs/BsdFileStore.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2019, 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 @@ -62,22 +62,14 @@ } // step 2: find mount point - UnixPath parent = path.getParent(); - while (parent != null) { - UnixFileAttributes attrs = null; - try { - attrs = UnixFileAttributes.get(parent, true); - } catch (UnixException x) { - x.rethrowAsIOException(parent); - } - if (attrs.dev() != dev()) - break; - path = parent; - parent = parent.getParent(); + byte[] dir = null; + try { + dir = BsdNativeDispatcher.getmntonname(path); + } catch (UnixException x) { + x.rethrowAsIOException(path); } // step 3: lookup mounted file systems - byte[] dir = path.asByteArray(); for (UnixMountEntry entry: fs.getMountEntries()) { if (Arrays.equals(dir, entry.dir())) return entry;
--- a/src/solaris/classes/sun/nio/fs/BsdNativeDispatcher.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/solaris/classes/sun/nio/fs/BsdNativeDispatcher.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2019, 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 @@ -51,6 +51,20 @@ */ static native void endfsstat(long iter) throws UnixException; + /** + * int statfs(const char *path, struct statfs *buf); + * returns buf->f_mntonname (directory on which mounted) + */ + static byte[] getmntonname(UnixPath path) throws UnixException { + NativeBuffer pathBuffer = copyToNativeBuffer(path); + try { + return getmntonname0(pathBuffer.address()); + } finally { + pathBuffer.release(); + } + } + static native byte[] getmntonname0(long pathAddress) throws UnixException; + // initialize field IDs private static native void initIDs();
--- a/src/solaris/classes/sun/nio/fs/UnixNativeDispatcher.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/solaris/classes/sun/nio/fs/UnixNativeDispatcher.java Wed Oct 23 15:35:04 2019 +0100 @@ -36,7 +36,7 @@ protected UnixNativeDispatcher() { } // returns a NativeBuffer containing the given path - private static NativeBuffer copyToNativeBuffer(UnixPath path) { + static NativeBuffer copyToNativeBuffer(UnixPath path) { byte[] cstr = path.getByteArrayForSysCalls(); int size = cstr.length + 1; NativeBuffer buffer = NativeBuffers.getNativeBufferFromCache(size);
--- a/src/solaris/native/java/io/canonicalize_md.c Mon Sep 09 17:27:04 2019 +0100 +++ b/src/solaris/native/java/io/canonicalize_md.c Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2019, 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 @@ -211,11 +211,10 @@ char *p, *end, *r = NULL; char path[PATH_MAX + 1]; - strncpy(path, original, sizeof(path)); - if (path[PATH_MAX] != '\0') { - errno = ENAMETOOLONG; - return -1; - } + // strlen(original) <= PATH_MAX, see above + strncpy(path, original, PATH_MAX); + // append null for == case + path[PATH_MAX] = '\0'; end = path + strlen(path); for (p = end; p > path;) {
--- a/src/solaris/native/java/lang/java_props_macosx.c Mon Sep 09 17:27:04 2019 +0100 +++ b/src/solaris/native/java/lang/java_props_macosx.c Wed Oct 23 15:35:04 2019 +0100 @@ -47,6 +47,8 @@ #define LOCALEIDLENGTH 128 char *getMacOSXLocale(int cat) { const char* retVal = NULL; + char languageString[LOCALEIDLENGTH]; + char localeString[LOCALEIDLENGTH]; switch (cat) { case LC_MESSAGES: @@ -66,7 +68,6 @@ CFRelease(languages); return NULL; } - char languageString[LOCALEIDLENGTH]; if (CFStringGetCString(primaryLanguage, languageString, LOCALEIDLENGTH, CFStringGetSystemEncoding()) == false) { CFRelease(languages); @@ -81,7 +82,6 @@ // from Portuguese in Portugal), but this is missing when using the // "Portuguese (Brazil)" language. // If language is "pt" and the current locale is pt_BR, return pt_BR. - char localeString[LOCALEIDLENGTH]; if (strcmp(retVal, "pt") == 0 && CFStringGetCString(CFLocaleGetIdentifier(CFLocaleCopyCurrent()), localeString, LOCALEIDLENGTH, CFStringGetSystemEncoding()) && @@ -92,7 +92,6 @@ break; default: { - char localeString[LOCALEIDLENGTH]; if (!CFStringGetCString(CFLocaleGetIdentifier(CFLocaleCopyCurrent()), localeString, LOCALEIDLENGTH, CFStringGetSystemEncoding())) { return NULL;
--- a/src/solaris/native/sun/awt/gtk3_interface.c Mon Sep 09 17:27:04 2019 +0100 +++ b/src/solaris/native/sun/awt/gtk3_interface.c Wed Oct 23 15:35:04 2019 +0100 @@ -477,8 +477,7 @@ fp_gtk_fixed_new = dl_symbol("gtk_fixed_new"); fp_gtk_handle_box_new = dl_symbol("gtk_handle_box_new"); fp_gtk_image_new = dl_symbol("gtk_image_new"); - fp_gtk_hpaned_new = dl_symbol("gtk_hpaned_new"); - fp_gtk_vpaned_new = dl_symbol("gtk_vpaned_new"); + fp_gtk_paned_new = dl_symbol("gtk_paned_new"); fp_gtk_scale_new = dl_symbol("gtk_scale_new"); fp_gtk_hscrollbar_new = dl_symbol("gtk_hscrollbar_new"); fp_gtk_vscrollbar_new = dl_symbol("gtk_vscrollbar_new"); @@ -1081,7 +1080,7 @@ case SPLIT_PANE: if (init_result = (NULL == gtk3_widgets[_GTK_HPANED_TYPE])) { - gtk3_widgets[_GTK_HPANED_TYPE] = (*fp_gtk_hpaned_new)(); + gtk3_widgets[_GTK_HPANED_TYPE] = (*fp_gtk_paned_new)(GTK_ORIENTATION_HORIZONTAL); } result = gtk3_widgets[_GTK_HPANED_TYPE]; break; @@ -1314,7 +1313,7 @@ case VSPLIT_PANE_DIVIDER: if (init_result = (NULL == gtk3_widgets[_GTK_VPANED_TYPE])) { - gtk3_widgets[_GTK_VPANED_TYPE] = (*fp_gtk_vpaned_new)(); + gtk3_widgets[_GTK_VPANED_TYPE] = (*fp_gtk_paned_new)(GTK_ORIENTATION_VERTICAL); } result = gtk3_widgets[_GTK_VPANED_TYPE]; break; @@ -1434,6 +1433,10 @@ } else if (strcmp(detail, "option") == 0) { path = createWidgetPath (NULL); append_element(path, "radio"); + } else if (strcmp(detail, "paned") == 0) { + path = createWidgetPath (fp_gtk_style_context_get_path (widget_context)); + append_element(path, "paned"); + append_element(path, "separator"); } else { path = createWidgetPath (fp_gtk_style_context_get_path (widget_context)); append_element(path, detail); @@ -1832,22 +1835,30 @@ { gtk3_widget = gtk3_get_widget(widget_type); - GtkStyleContext* context = fp_gtk_widget_get_style_context (gtk3_widget); - - fp_gtk_style_context_save (context); + GtkStyleContext* context = get_style(widget_type, detail); GtkStateFlags flags = get_gtk_flags(state_type); fp_gtk_style_context_set_state(context, GTK_STATE_FLAG_PRELIGHT); - if (detail != 0) { + if (detail != 0 && !(strcmp(detail, "paned") == 0)) { transform_detail_string(detail, context); fp_gtk_style_context_add_class (context, "handlebox_bin"); } - fp_gtk_render_handle(context, cr, x, y, width, height); - fp_gtk_render_background(context, cr, x, y, width, height); - - fp_gtk_style_context_restore (context); + if (!(strcmp(detail, "paned") == 0)) { + fp_gtk_render_handle(context, cr, x, y, width, height); + fp_gtk_render_background(context, cr, x, y, width, height); + } else { + if (orientation == GTK_ORIENTATION_VERTICAL) { + fp_gtk_render_handle(context, cr, x+width/2, y, 2, height); + fp_gtk_render_background(context, cr, x+width/2, y, 2, height); + } else { + fp_gtk_render_handle(context, cr, x, y+height/2, width, 2); + fp_gtk_render_background(context, cr, x, y+height/2, width, 2); + } + } + + disposeOrRestoreContext(context); } static void gtk3_paint_hline(WidgetType widget_type, GtkStateType state_type,
--- a/src/solaris/native/sun/awt/gtk3_interface.h Mon Sep 09 17:27:04 2019 +0100 +++ b/src/solaris/native/sun/awt/gtk3_interface.h Wed Oct 23 15:35:04 2019 +0100 @@ -163,6 +163,7 @@ typedef void GtkProgressBar; typedef void GtkProgress; typedef void GtkWidgetPath; +typedef void GtkPaned; /* Some real structures */ typedef struct @@ -502,8 +503,7 @@ static GtkWidget* (*fp_gtk_entry_new)(); static GtkWidget* (*fp_gtk_fixed_new)(); static GtkWidget* (*fp_gtk_handle_box_new)(); -static GtkWidget* (*fp_gtk_hpaned_new)(); -static GtkWidget* (*fp_gtk_vpaned_new)(); +static GtkWidget* (*fp_gtk_paned_new)(GtkOrientation orientation); static GtkWidget* (*fp_gtk_scale_new)(GtkOrientation orientation, GtkAdjustment* adjustment); static GtkWidget* (*fp_gtk_hscrollbar_new)(GtkAdjustment* adjustment);
--- a/src/solaris/native/sun/java2d/x11/X11FontScaler_md.c Mon Sep 09 17:27:04 2019 +0100 +++ b/src/solaris/native/sun/java2d/x11/X11FontScaler_md.c Wed Oct 23 15:35:04 2019 +0100 @@ -273,6 +273,7 @@ unsigned int imageSize; JNIEnv *env; + FONT_AWT_LOCK(); /* XTextExtents16(xFont, xChar, 1, &direction, &ascent, &descent, &xcs); */ XQueryTextExtents16(awt_display,xFont->fid, xChar, 1, @@ -280,8 +281,11 @@ width = xcs.rbearing - xcs.lbearing; height = xcs.ascent+xcs.descent; imageSize = width*height; - glyphInfo = (GlyphInfo*)malloc(sizeof(GlyphInfo)+imageSize); + if (glyphInfo == NULL) { + AWT_UNLOCK(); + return (jlong)(uintptr_t)NULL; + } glyphInfo->cellInfo = NULL; glyphInfo->width = width; glyphInfo->height = height;
--- a/src/solaris/native/sun/nio/fs/BsdNativeDispatcher.c Mon Sep 09 17:27:04 2019 +0100 +++ b/src/solaris/native/sun/nio/fs/BsdNativeDispatcher.c Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2019, 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 @@ -203,3 +203,24 @@ free(iter); } } + +JNIEXPORT jbyteArray JNICALL +Java_sun_nio_fs_BsdNativeDispatcher_getmntonname0(JNIEnv *env, jclass this, + jlong pathAddress) +{ + struct statfs buf; + const char* path = (const char*)jlong_to_ptr(pathAddress); + + if (statfs(path, &buf) != 0) { + throwUnixException(env, errno); + } + + jsize len = strlen(buf.f_mntonname); + jbyteArray mntonname = (*env)->NewByteArray(env, len); + if (mntonname != NULL) { + (*env)->SetByteArrayRegion(env, mntonname, 0, len, + (jbyte*)buf.f_mntonname); + } + + return mntonname; +}
--- a/src/solaris/native/sun/security/smartcardio/MUSCLE/COPYING Mon Sep 09 17:27:04 2019 +0100 +++ b/src/solaris/native/sun/security/smartcardio/MUSCLE/COPYING Wed Oct 23 15:35:04 2019 +0100 @@ -1,4 +1,5 @@ -Copyright (c) 1999-2003 David Corcoran <corcoran@linuxnet.com> +Copyright (c) 1999-2003 David Corcoran <corcoran@musclecard.com> +Copyright (c) 2001-2011 Ludovic Rousseau <ludovic.rousseau@free.fr> All rights reserved. Redistribution and use in source and binary forms, with or without @@ -13,9 +14,6 @@ 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. -Changes to this license can be made only by the copyright author with -explicit written consent. - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. @@ -26,3 +24,72 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +Some files are under GNU GPL v3 or any later version +- doc/example/pcsc_demo.c +- the files in src/spy/ +- the files in UnitaryTests/ + + Copyright (C) 2003-2014 Ludovic Rousseau + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program 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 for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + +Files src/auth.c and src/auth.h are: + * Copyright (C) 2013 Red Hat + * + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * Author: Nikos Mavrogiannopoulos <nmav@redhat.com> + + +Files src/simclist.c and src/simclist.h are: + * Copyright (c) 2007,2008,2009,2010,2011 Mij <mij@bitchx.it> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +
--- a/src/solaris/native/sun/security/smartcardio/MUSCLE/pcsclite.h Mon Sep 09 17:27:04 2019 +0100 +++ b/src/solaris/native/sun/security/smartcardio/MUSCLE/pcsclite.h Wed Oct 23 15:35:04 2019 +0100 @@ -1,374 +1,306 @@ /* - * This keeps a list of defines for pcsc-lite. - * - * MUSCLE SmartCard Development ( http://www.linuxnet.com ) + * MUSCLE SmartCard Development ( https://pcsclite.apdu.fr/ ) * * Copyright (C) 1999-2004 - * David Corcoran <corcoran@linuxnet.com> + * David Corcoran <corcoran@musclecard.com> + * Copyright (C) 2002-2011 * Ludovic Rousseau <ludovic.rousseau@free.fr> + * Copyright (C) 2005 + * Martin Paljak <martin@paljak.pri.ee> * - * $Id: pcsclite.h.in,v 1.47 2004/08/24 21:46:57 rousseau Exp $ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * @brief This keeps a list of defines for pcsc-lite. + * + * Error codes from http://msdn.microsoft.com/en-us/library/aa924526.aspx */ #ifndef __pcsclite_h__ #define __pcsclite_h__ -#ifndef __sun_jdk #include <wintypes.h> -#else -#include <sys/types.h> -#include <inttypes.h> -#ifdef BYTE -#error BYTE is already defined -#else - typedef unsigned char BYTE; -#endif /* End BYTE */ - - typedef unsigned char UCHAR; - typedef unsigned char *PUCHAR; - typedef unsigned short USHORT; - typedef unsigned long ULONG; - typedef void *LPVOID; - typedef short BOOL; - typedef unsigned long *PULONG; - typedef const void *LPCVOID; - typedef unsigned long DWORD; - typedef unsigned long *PDWORD; - typedef unsigned short WORD; - typedef long LONG; - typedef long RESPONSECODE; - typedef const char *LPCTSTR; - typedef const BYTE *LPCBYTE; - typedef BYTE *LPBYTE; - typedef DWORD *LPDWORD; - typedef char *LPTSTR; - -#endif #ifdef __cplusplus extern "C" { #endif -#ifdef WIN32 -#include <winscard.h> -#else -typedef long SCARDCONTEXT; +typedef LONG SCARDCONTEXT; /**< \p hContext returned by SCardEstablishContext() */ typedef SCARDCONTEXT *PSCARDCONTEXT; typedef SCARDCONTEXT *LPSCARDCONTEXT; -typedef long SCARDHANDLE; +typedef LONG SCARDHANDLE; /**< \p hCard returned by SCardConnect() */ typedef SCARDHANDLE *PSCARDHANDLE; typedef SCARDHANDLE *LPSCARDHANDLE; -#define MAX_ATR_SIZE 33 /* Maximum ATR size */ +#define MAX_ATR_SIZE 33 /**< Maximum ATR size */ -#ifndef __APPLE__ +/* Set structure elements aligment on bytes + * http://gcc.gnu.org/onlinedocs/gcc/Structure_002dPacking-Pragmas.html */ +#ifdef __APPLE__ +#pragma pack(1) +#endif typedef struct { - const char *szReader; - void *pvUserData; - unsigned long dwCurrentState; - unsigned long dwEventState; - unsigned long cbAtr; - unsigned char rgbAtr[MAX_ATR_SIZE]; + const char *szReader; + void *pvUserData; + DWORD dwCurrentState; + DWORD dwEventState; + DWORD cbAtr; + unsigned char rgbAtr[MAX_ATR_SIZE]; } -SCARD_READERSTATE_A; +SCARD_READERSTATE, *LPSCARD_READERSTATE; -typedef struct _SCARD_IO_REQUEST -{ - unsigned long dwProtocol; /* Protocol identifier */ - unsigned long cbPciLength; /* Protocol Control Inf Length */ -} -SCARD_IO_REQUEST, *PSCARD_IO_REQUEST, *LPSCARD_IO_REQUEST; - -#else // __APPLE__ - -#pragma pack(1) +/** Protocol Control Information (PCI) */ typedef struct { - const char *szReader; - void *pvUserData; - uint32_t dwCurrentState; - uint32_t dwEventState; - uint32_t cbAtr; - unsigned char rgbAtr[MAX_ATR_SIZE]; -} -SCARD_READERSTATE_A; - -typedef struct _SCARD_IO_REQUEST -{ - uint32_t dwProtocol; /* Protocol identifier */ - uint32_t cbPciLength; /* Protocol Control Inf Length */ + unsigned long dwProtocol; /**< Protocol identifier */ + unsigned long cbPciLength; /**< Protocol Control Inf Length */ } SCARD_IO_REQUEST, *PSCARD_IO_REQUEST, *LPSCARD_IO_REQUEST; -#pragma pack() - -#endif // __APPLE__ - -typedef SCARD_READERSTATE_A SCARD_READERSTATE, *PSCARD_READERSTATE_A, - *LPSCARD_READERSTATE_A; typedef const SCARD_IO_REQUEST *LPCSCARD_IO_REQUEST; -extern SCARD_IO_REQUEST g_rgSCardT0Pci, g_rgSCardT1Pci, - g_rgSCardRawPci; - -#define SCARD_PCI_T0 (&g_rgSCardT0Pci) -#define SCARD_PCI_T1 (&g_rgSCardT1Pci) -#define SCARD_PCI_RAW (&g_rgSCardRawPci) - -#define SCARD_S_SUCCESS 0x00000000 -#define SCARD_E_CANCELLED 0x80100002 -#define SCARD_E_CANT_DISPOSE 0x8010000E -#define SCARD_E_INSUFFICIENT_BUFFER 0x80100008 -#define SCARD_E_INVALID_ATR 0x80100015 -#define SCARD_E_INVALID_HANDLE 0x80100003 -#define SCARD_E_INVALID_PARAMETER 0x80100004 -#define SCARD_E_INVALID_TARGET 0x80100005 -#define SCARD_E_INVALID_VALUE 0x80100011 -#define SCARD_E_NO_MEMORY 0x80100006 -#define SCARD_F_COMM_ERROR 0x80100013 -#define SCARD_F_INTERNAL_ERROR 0x80100001 -#define SCARD_F_UNKNOWN_ERROR 0x80100014 -#define SCARD_F_WAITED_TOO_LONG 0x80100007 -#define SCARD_E_UNKNOWN_READER 0x80100009 -#define SCARD_E_TIMEOUT 0x8010000A -#define SCARD_E_SHARING_VIOLATION 0x8010000B -#define SCARD_E_NO_SMARTCARD 0x8010000C -#define SCARD_E_UNKNOWN_CARD 0x8010000D -#define SCARD_E_PROTO_MISMATCH 0x8010000F -#define SCARD_E_NOT_READY 0x80100010 -#define SCARD_E_SYSTEM_CANCELLED 0x80100012 -#define SCARD_E_NOT_TRANSACTED 0x80100016 -#define SCARD_E_READER_UNAVAILABLE 0x80100017 - -#define SCARD_W_UNSUPPORTED_CARD 0x80100065 -#define SCARD_W_UNRESPONSIVE_CARD 0x80100066 -#define SCARD_W_UNPOWERED_CARD 0x80100067 -#define SCARD_W_RESET_CARD 0x80100068 -#define SCARD_W_REMOVED_CARD 0x80100069 - -#define SCARD_E_PCI_TOO_SMALL 0x80100019 -#define SCARD_E_READER_UNSUPPORTED 0x8010001A -#define SCARD_E_DUPLICATE_READER 0x8010001B -#define SCARD_E_CARD_UNSUPPORTED 0x8010001C -#define SCARD_E_NO_SERVICE 0x8010001D -#define SCARD_E_SERVICE_STOPPED 0x8010001E - -#define SCARD_SCOPE_USER 0x0000 /* Scope in user space */ -#define SCARD_SCOPE_TERMINAL 0x0001 /* Scope in terminal */ -#define SCARD_SCOPE_SYSTEM 0x0002 /* Scope in system */ - -#define SCARD_PROTOCOL_UNSET 0x0000 /* protocol not set */ -#define SCARD_PROTOCOL_T0 0x0001 /* T=0 active protocol. */ -#define SCARD_PROTOCOL_T1 0x0002 /* T=1 active protocol. */ -#define SCARD_PROTOCOL_RAW 0x0004 /* Raw active protocol. */ -#define SCARD_PROTOCOL_T15 0x0008 /* T=15 protocol. */ - -#define SCARD_PROTOCOL_ANY (SCARD_PROTOCOL_T0|SCARD_PROTOCOL_T1) /* IFD determines prot. */ - -#define SCARD_SHARE_EXCLUSIVE 0x0001 /* Exclusive mode only */ -#define SCARD_SHARE_SHARED 0x0002 /* Shared mode only */ -#define SCARD_SHARE_DIRECT 0x0003 /* Raw mode only */ - -#define SCARD_LEAVE_CARD 0x0000 /* Do nothing on close */ -#define SCARD_RESET_CARD 0x0001 /* Reset on close */ -#define SCARD_UNPOWER_CARD 0x0002 /* Power down on close */ -#define SCARD_EJECT_CARD 0x0003 /* Eject on close */ - -#define SCARD_UNKNOWN 0x0001 /* Unknown state */ -#define SCARD_ABSENT 0x0002 /* Card is absent */ -#define SCARD_PRESENT 0x0004 /* Card is present */ -#define SCARD_SWALLOWED 0x0008 /* Card not powered */ -#define SCARD_POWERED 0x0010 /* Card is powered */ -#define SCARD_NEGOTIABLE 0x0020 /* Ready for PTS */ -#define SCARD_SPECIFIC 0x0040 /* PTS has been set */ +extern const SCARD_IO_REQUEST g_rgSCardT0Pci, g_rgSCardT1Pci, g_rgSCardRawPci; -#define SCARD_STATE_UNAWARE 0x0000 /* App wants status */ -#define SCARD_STATE_IGNORE 0x0001 /* Ignore this reader */ -#define SCARD_STATE_CHANGED 0x0002 /* State has changed */ -#define SCARD_STATE_UNKNOWN 0x0004 /* Reader unknown */ -#define SCARD_STATE_UNAVAILABLE 0x0008 /* Status unavailable */ -#define SCARD_STATE_EMPTY 0x0010 /* Card removed */ -#define SCARD_STATE_PRESENT 0x0020 /* Card inserted */ -#define SCARD_STATE_ATRMATCH 0x0040 /* ATR matches card */ -#define SCARD_STATE_EXCLUSIVE 0x0080 /* Exclusive Mode */ -#define SCARD_STATE_INUSE 0x0100 /* Shared Mode */ -#define SCARD_STATE_MUTE 0x0200 /* Unresponsive card */ -#define SCARD_STATE_UNPOWERED 0x0400 /* Unpowered card */ - -/* - * Tags for requesting card and reader attributes - */ - -#define SCARD_ATTR_VALUE(Class, Tag) ((((ULONG)(Class)) << 16) | ((ULONG)(Tag))) - -#define SCARD_CLASS_VENDOR_INFO 1 /* Vendor information definitions */ -#define SCARD_CLASS_COMMUNICATIONS 2 /* Communication definitions */ -#define SCARD_CLASS_PROTOCOL 3 /* Protocol definitions */ -#define SCARD_CLASS_POWER_MGMT 4 /* Power Management definitions */ -#define SCARD_CLASS_SECURITY 5 /* Security Assurance definitions */ -#define SCARD_CLASS_MECHANICAL 6 /* Mechanical characteristic definitions */ -#define SCARD_CLASS_VENDOR_DEFINED 7 /* Vendor specific definitions */ -#define SCARD_CLASS_IFD_PROTOCOL 8 /* Interface Device Protocol options */ -#define SCARD_CLASS_ICC_STATE 9 /* ICC State specific definitions */ -#define SCARD_CLASS_SYSTEM 0x7fff /* System-specific definitions */ - -#define SCARD_ATTR_VENDOR_NAME SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_INFO, 0x0100) -#define SCARD_ATTR_VENDOR_IFD_TYPE SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_INFO, 0x0101) -#define SCARD_ATTR_VENDOR_IFD_VERSION SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_INFO, 0x0102) -#define SCARD_ATTR_VENDOR_IFD_SERIAL_NO SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_INFO, 0x0103) -#define SCARD_ATTR_CHANNEL_ID SCARD_ATTR_VALUE(SCARD_CLASS_COMMUNICATIONS, 0x0110) -#define SCARD_ATTR_ASYNC_PROTOCOL_TYPES SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0120) -#define SCARD_ATTR_DEFAULT_CLK SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0121) -#define SCARD_ATTR_MAX_CLK SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0122) -#define SCARD_ATTR_DEFAULT_DATA_RATE SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0123) -#define SCARD_ATTR_MAX_DATA_RATE SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0124) -#define SCARD_ATTR_MAX_IFSD SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0125) -#define SCARD_ATTR_SYNC_PROTOCOL_TYPES SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0126) -#define SCARD_ATTR_POWER_MGMT_SUPPORT SCARD_ATTR_VALUE(SCARD_CLASS_POWER_MGMT, 0x0131) -#define SCARD_ATTR_USER_TO_CARD_AUTH_DEVICE SCARD_ATTR_VALUE(SCARD_CLASS_SECURITY, 0x0140) -#define SCARD_ATTR_USER_AUTH_INPUT_DEVICE SCARD_ATTR_VALUE(SCARD_CLASS_SECURITY, 0x0142) -#define SCARD_ATTR_CHARACTERISTICS SCARD_ATTR_VALUE(SCARD_CLASS_MECHANICAL, 0x0150) - -#define SCARD_ATTR_CURRENT_PROTOCOL_TYPE SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0201) -#define SCARD_ATTR_CURRENT_CLK SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0202) -#define SCARD_ATTR_CURRENT_F SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0203) -#define SCARD_ATTR_CURRENT_D SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0204) -#define SCARD_ATTR_CURRENT_N SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0205) -#define SCARD_ATTR_CURRENT_W SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0206) -#define SCARD_ATTR_CURRENT_IFSC SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0207) -#define SCARD_ATTR_CURRENT_IFSD SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0208) -#define SCARD_ATTR_CURRENT_BWT SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0209) -#define SCARD_ATTR_CURRENT_CWT SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x020a) -#define SCARD_ATTR_CURRENT_EBC_ENCODING SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x020b) -#define SCARD_ATTR_EXTENDED_BWT SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x020c) - -#define SCARD_ATTR_ICC_PRESENCE SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0300) -#define SCARD_ATTR_ICC_INTERFACE_STATUS SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0301) -#define SCARD_ATTR_CURRENT_IO_STATE SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0302) -#define SCARD_ATTR_ATR_STRING SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0303) -#define SCARD_ATTR_ICC_TYPE_PER_ATR SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0304) - -#define SCARD_ATTR_ESC_RESET SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED, 0xA000) -#define SCARD_ATTR_ESC_CANCEL SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED, 0xA003) -#define SCARD_ATTR_ESC_AUTHREQUEST SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED, 0xA005) -#define SCARD_ATTR_MAXINPUT SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED, 0xA007) - -#define SCARD_ATTR_DEVICE_UNIT SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0001) -#define SCARD_ATTR_DEVICE_IN_USE SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0002) -#define SCARD_ATTR_DEVICE_FRIENDLY_NAME_A SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0003) -#define SCARD_ATTR_DEVICE_SYSTEM_NAME_A SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0004) -#define SCARD_ATTR_DEVICE_FRIENDLY_NAME_W SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0005) -#define SCARD_ATTR_DEVICE_SYSTEM_NAME_W SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0006) -#define SCARD_ATTR_SUPRESS_T1_IFS_REQUEST SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0007) - -#ifdef UNICODE -#define SCARD_ATTR_DEVICE_FRIENDLY_NAME SCARD_ATTR_DEVICE_FRIENDLY_NAME_W -#define SCARD_ATTR_DEVICE_SYSTEM_NAME SCARD_ATTR_DEVICE_SYSTEM_NAME_W -#else -#define SCARD_ATTR_DEVICE_FRIENDLY_NAME SCARD_ATTR_DEVICE_FRIENDLY_NAME_A -#define SCARD_ATTR_DEVICE_SYSTEM_NAME SCARD_ATTR_DEVICE_SYSTEM_NAME_A +/* restore default structure elements alignment */ +#ifdef __APPLE__ +#pragma pack() #endif -#endif - -/* PC/SC Lite specific extensions */ -#define SCARD_W_INSERTED_CARD 0x8010006A -#define SCARD_E_UNSUPPORTED_FEATURE 0x8010001F - -#define SCARD_SCOPE_GLOBAL 0x0003 /* Scope is global */ - -#define SCARD_RESET 0x0001 /* Card was reset */ -#define SCARD_INSERTED 0x0002 /* Card was inserted */ -#define SCARD_REMOVED 0x0004 /* Card was removed */ +#define SCARD_PCI_T0 (&g_rgSCardT0Pci) /**< protocol control information (PCI) for T=0 */ +#define SCARD_PCI_T1 (&g_rgSCardT1Pci) /**< protocol control information (PCI) for T=1 */ +#define SCARD_PCI_RAW (&g_rgSCardRawPci) /**< protocol control information (PCI) for RAW protocol */ -#define BLOCK_STATUS_RESUME 0x00FF /* Normal resume */ -#define BLOCK_STATUS_BLOCKING 0x00FA /* Function is blocking */ - -#define PCSCLITE_CONFIG_DIR "/etc" +/** + * @defgroup ErrorCodes ErrorCodes + * @brief Error code documentation + * + * The error codes descriptions are from + * http://msdn.microsoft.com/en-us/library/aa924526.aspx + */ +/** @ingroup ErrorCodes */ +#define SCARD_S_SUCCESS ((LONG)0x00000000) /**< No error was encountered. */ +/** @ingroup ErrorCodes */ +#define SCARD_F_INTERNAL_ERROR ((LONG)0x80100001) /**< An internal consistency check failed. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_CANCELLED ((LONG)0x80100002) /**< The action was cancelled by an SCardCancel request. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_INVALID_HANDLE ((LONG)0x80100003) /**< The supplied handle was invalid. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_INVALID_PARAMETER ((LONG)0x80100004) /**< One or more of the supplied parameters could not be properly interpreted. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_INVALID_TARGET ((LONG)0x80100005) /**< Registry startup information is missing or invalid. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_NO_MEMORY ((LONG)0x80100006) /**< Not enough memory available to complete this command. */ +/** @ingroup ErrorCodes */ +#define SCARD_F_WAITED_TOO_LONG ((LONG)0x80100007) /**< An internal consistency timer has expired. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_INSUFFICIENT_BUFFER ((LONG)0x80100008) /**< The data buffer to receive returned data is too small for the returned data. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_UNKNOWN_READER ((LONG)0x80100009) /**< The specified reader name is not recognized. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_TIMEOUT ((LONG)0x8010000A) /**< The user-specified timeout value has expired. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_SHARING_VIOLATION ((LONG)0x8010000B) /**< The smart card cannot be accessed because of other connections outstanding. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_NO_SMARTCARD ((LONG)0x8010000C) /**< The operation requires a Smart Card, but no Smart Card is currently in the device. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_UNKNOWN_CARD ((LONG)0x8010000D) /**< The specified smart card name is not recognized. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_CANT_DISPOSE ((LONG)0x8010000E) /**< The system could not dispose of the media in the requested manner. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_PROTO_MISMATCH ((LONG)0x8010000F) /**< The requested protocols are incompatible with the protocol currently in use with the smart card. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_NOT_READY ((LONG)0x80100010) /**< The reader or smart card is not ready to accept commands. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_INVALID_VALUE ((LONG)0x80100011) /**< One or more of the supplied parameters values could not be properly interpreted. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_SYSTEM_CANCELLED ((LONG)0x80100012) /**< The action was cancelled by the system, presumably to log off or shut down. */ +/** @ingroup ErrorCodes */ +#define SCARD_F_COMM_ERROR ((LONG)0x80100013) /**< An internal communications error has been detected. */ +/** @ingroup ErrorCodes */ +#define SCARD_F_UNKNOWN_ERROR ((LONG)0x80100014) /**< An internal error has been detected, but the source is unknown. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_INVALID_ATR ((LONG)0x80100015) /**< An ATR obtained from the registry is not a valid ATR string. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_NOT_TRANSACTED ((LONG)0x80100016) /**< An attempt was made to end a non-existent transaction. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_READER_UNAVAILABLE ((LONG)0x80100017) /**< The specified reader is not currently available for use. */ +/** @ingroup ErrorCodes */ +#define SCARD_P_SHUTDOWN ((LONG)0x80100018) /**< The operation has been aborted to allow the server application to exit. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_PCI_TOO_SMALL ((LONG)0x80100019) /**< The PCI Receive buffer was too small. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_READER_UNSUPPORTED ((LONG)0x8010001A) /**< The reader driver does not meet minimal requirements for support. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_DUPLICATE_READER ((LONG)0x8010001B) /**< The reader driver did not produce a unique reader name. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_CARD_UNSUPPORTED ((LONG)0x8010001C) /**< The smart card does not meet minimal requirements for support. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_NO_SERVICE ((LONG)0x8010001D) /**< The Smart card resource manager is not running. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_SERVICE_STOPPED ((LONG)0x8010001E) /**< The Smart card resource manager has shut down. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_UNEXPECTED ((LONG)0x8010001F) /**< An unexpected card error has occurred. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_UNSUPPORTED_FEATURE ((LONG)0x8010001F) /**< This smart card does not support the requested feature. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_ICC_INSTALLATION ((LONG)0x80100020) /**< No primary provider can be found for the smart card. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_ICC_CREATEORDER ((LONG)0x80100021) /**< The requested order of object creation is not supported. */ +/** @ingroup ErrorCodes */ +/* #define SCARD_E_UNSUPPORTED_FEATURE ((LONG)0x80100022) / **< This smart card does not support the requested feature. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_DIR_NOT_FOUND ((LONG)0x80100023) /**< The identified directory does not exist in the smart card. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_FILE_NOT_FOUND ((LONG)0x80100024) /**< The identified file does not exist in the smart card. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_NO_DIR ((LONG)0x80100025) /**< The supplied path does not represent a smart card directory. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_NO_FILE ((LONG)0x80100026) /**< The supplied path does not represent a smart card file. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_NO_ACCESS ((LONG)0x80100027) /**< Access is denied to this file. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_WRITE_TOO_MANY ((LONG)0x80100028) /**< The smart card does not have enough memory to store the information. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_BAD_SEEK ((LONG)0x80100029) /**< There was an error trying to set the smart card file object pointer. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_INVALID_CHV ((LONG)0x8010002A) /**< The supplied PIN is incorrect. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_UNKNOWN_RES_MNG ((LONG)0x8010002B) /**< An unrecognized error code was returned from a layered component. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_NO_SUCH_CERTIFICATE ((LONG)0x8010002C) /**< The requested certificate does not exist. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_CERTIFICATE_UNAVAILABLE ((LONG)0x8010002D) /**< The requested certificate could not be obtained. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_NO_READERS_AVAILABLE ((LONG)0x8010002E) /**< Cannot find a smart card reader. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_COMM_DATA_LOST ((LONG)0x8010002F) /**< A communications error with the smart card has been detected. Retry the operation. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_NO_KEY_CONTAINER ((LONG)0x80100030) /**< The requested key container does not exist on the smart card. */ +/** @ingroup ErrorCodes */ +#define SCARD_E_SERVER_TOO_BUSY ((LONG)0x80100031) /**< The Smart Card Resource Manager is too busy to complete this operation. */ -#ifndef USE_IPCDIR -#define PCSCLITE_IPC_DIR "/var/run" -#else -#define PCSCLITE_IPC_DIR USE_IPCDIR -#endif +/** @ingroup ErrorCodes */ +#define SCARD_W_UNSUPPORTED_CARD ((LONG)0x80100065) /**< The reader cannot communicate with the card, due to ATR string configuration conflicts. */ +/** @ingroup ErrorCodes */ +#define SCARD_W_UNRESPONSIVE_CARD ((LONG)0x80100066) /**< The smart card is not responding to a reset. */ +/** @ingroup ErrorCodes */ +#define SCARD_W_UNPOWERED_CARD ((LONG)0x80100067) /**< Power has been removed from the smart card, so that further communication is not possible. */ +/** @ingroup ErrorCodes */ +#define SCARD_W_RESET_CARD ((LONG)0x80100068) /**< The smart card has been reset, so any shared state information is invalid. */ +/** @ingroup ErrorCodes */ +#define SCARD_W_REMOVED_CARD ((LONG)0x80100069) /**< The smart card has been removed, so further communication is not possible. */ + +/** @ingroup ErrorCodes */ +#define SCARD_W_SECURITY_VIOLATION ((LONG)0x8010006A) /**< Access was denied because of a security violation. */ +/** @ingroup ErrorCodes */ +#define SCARD_W_WRONG_CHV ((LONG)0x8010006B) /**< The card cannot be accessed because the wrong PIN was presented. */ +/** @ingroup ErrorCodes */ +#define SCARD_W_CHV_BLOCKED ((LONG)0x8010006C) /**< The card cannot be accessed because the maximum number of PIN entry attempts has been reached. */ +/** @ingroup ErrorCodes */ +#define SCARD_W_EOF ((LONG)0x8010006D) /**< The end of the smart card file has been reached. */ +/** @ingroup ErrorCodes */ +#define SCARD_W_CANCELLED_BY_USER ((LONG)0x8010006E) /**< The user pressed "Cancel" on a Smart Card Selection Dialog. */ +/** @ingroup ErrorCodes */ +#define SCARD_W_CARD_NOT_AUTHENTICATED ((LONG)0x8010006F) /**< No PIN was presented to the smart card. */ + +#define SCARD_AUTOALLOCATE (DWORD)(-1) /**< see SCardFreeMemory() */ +#define SCARD_SCOPE_USER 0x0000 /**< Scope in user space */ +#define SCARD_SCOPE_TERMINAL 0x0001 /**< Scope in terminal */ +#define SCARD_SCOPE_SYSTEM 0x0002 /**< Scope in system */ +#define SCARD_SCOPE_GLOBAL 0x0003 /**< Scope is global */ -#define PCSCLITE_READER_CONFIG PCSCLITE_CONFIG_DIR "/reader.conf" -#define PCSCLITE_PUBSHM_FILE PCSCLITE_IPC_DIR "/pcscd.pub" -#define PCSCLITE_CSOCK_NAME PCSCLITE_IPC_DIR "/pcscd.comm" +#define SCARD_PROTOCOL_UNDEFINED 0x0000 /**< protocol not set */ +#define SCARD_PROTOCOL_UNSET SCARD_PROTOCOL_UNDEFINED /* backward compat */ +#define SCARD_PROTOCOL_T0 0x0001 /**< T=0 active protocol. */ +#define SCARD_PROTOCOL_T1 0x0002 /**< T=1 active protocol. */ +#define SCARD_PROTOCOL_RAW 0x0004 /**< Raw active protocol. */ +#define SCARD_PROTOCOL_T15 0x0008 /**< T=15 protocol. */ + +#define SCARD_PROTOCOL_ANY (SCARD_PROTOCOL_T0|SCARD_PROTOCOL_T1) /**< IFD determines prot. */ + +#define SCARD_SHARE_EXCLUSIVE 0x0001 /**< Exclusive mode only */ +#define SCARD_SHARE_SHARED 0x0002 /**< Shared mode only */ +#define SCARD_SHARE_DIRECT 0x0003 /**< Raw mode only */ + +#define SCARD_LEAVE_CARD 0x0000 /**< Do nothing on close */ +#define SCARD_RESET_CARD 0x0001 /**< Reset on close */ +#define SCARD_UNPOWER_CARD 0x0002 /**< Power down on close */ +#define SCARD_EJECT_CARD 0x0003 /**< Eject on close */ -#define PCSCLITE_SVC_IDENTITY 0x01030000 /* Service ID */ +#define SCARD_UNKNOWN 0x0001 /**< Unknown state */ +#define SCARD_ABSENT 0x0002 /**< Card is absent */ +#define SCARD_PRESENT 0x0004 /**< Card is present */ +#define SCARD_SWALLOWED 0x0008 /**< Card not powered */ +#define SCARD_POWERED 0x0010 /**< Card is powered */ +#define SCARD_NEGOTIABLE 0x0020 /**< Ready for PTS */ +#define SCARD_SPECIFIC 0x0040 /**< PTS has been set */ + +#define SCARD_STATE_UNAWARE 0x0000 /**< App wants status */ +#define SCARD_STATE_IGNORE 0x0001 /**< Ignore this reader */ +#define SCARD_STATE_CHANGED 0x0002 /**< State has changed */ +#define SCARD_STATE_UNKNOWN 0x0004 /**< Reader unknown */ +#define SCARD_STATE_UNAVAILABLE 0x0008 /**< Status unavailable */ +#define SCARD_STATE_EMPTY 0x0010 /**< Card removed */ +#define SCARD_STATE_PRESENT 0x0020 /**< Card inserted */ +#define SCARD_STATE_ATRMATCH 0x0040 /**< ATR matches card */ +#define SCARD_STATE_EXCLUSIVE 0x0080 /**< Exclusive Mode */ +#define SCARD_STATE_INUSE 0x0100 /**< Shared Mode */ +#define SCARD_STATE_MUTE 0x0200 /**< Unresponsive card */ +#define SCARD_STATE_UNPOWERED 0x0400 /**< Unpowered card */ #ifndef INFINITE -#define INFINITE 0xFFFFFFFF /* Infinite timeout */ +#define INFINITE 0xFFFFFFFF /**< Infinite timeout */ #endif -#define PCSCLITE_INFINITE_TIMEOUT 4320000 /* 50 day infinite t/o */ - -#define PCSCLITE_VERSION_NUMBER "1.2.9-beta7" /* Current version */ -#define PCSCLITE_CLIENT_ATTEMPTS 120 /* Attempts to reach sv */ -#define PCSCLITE_MCLIENT_ATTEMPTS 20 /* Attempts to reach sv */ -#define PCSCLITE_STATUS_POLL_RATE 400000 /* Status polling rate */ -#define PCSCLITE_MSG_KEY_LEN 16 /* App ID key length */ -#define PCSCLITE_RW_ATTEMPTS 100 /* Attempts to rd/wrt */ -/* Maximum applications */ -#define PCSCLITE_MAX_APPLICATIONS 16 -/* Maximum contexts by application */ -#define PCSCLITE_MAX_APPLICATION_CONTEXTS 16 -/* Maximum of applications contexts that pcscd can accept */ -#define PCSCLITE_MAX_APPLICATIONS_CONTEXTS \ - PCSCLITE_MAX_APPLICATIONS * PCSCLITE_MAX_APPLICATION_CONTEXTS -/* Maximum channels on a reader context */ -#define PCSCLITE_MAX_READER_CONTEXT_CHANNELS 16 -/* Maximum channels on an application context */ -#define PCSCLITE_MAX_APPLICATION_CONTEXT_CHANNELS 16 -/* Maximum readers context (a slot is count as a reader) */ -#define PCSCLITE_MAX_READERS_CONTEXTS 16 +#define PCSCLITE_VERSION_NUMBER "1.8.24" /**< Current version */ +/** Maximum readers context (a slot is count as a reader) */ +#define PCSCLITE_MAX_READERS_CONTEXTS 16 -/* PCSCLITE_MAX_READERS is deprecated - * use PCSCLITE_MAX_READERS_CONTEXTS instead */ -/* extern int PCSCLITE_MAX_READERS __attribute__ ((deprecated)); */ - -#define PCSCLITE_MAX_THREADS 16 /* Stat change threads */ -#define PCSCLITE_STATUS_WAIT 200000 /* Status Change Sleep */ -#define PCSCLITE_TRANSACTION_TIMEOUT 40 /* Transaction timeout */ -#define MAX_READERNAME 52 -#define MAX_LIBNAME 100 -#define MAX_DEVICENAME 255 +#define MAX_READERNAME 128 #ifndef SCARD_ATR_LENGTH -#define SCARD_ATR_LENGTH MAX_ATR_SIZE /* Maximum ATR size */ +#define SCARD_ATR_LENGTH MAX_ATR_SIZE /**< Maximum ATR size */ #endif /* - * Enhanced messaging has been added to accommodate newer devices which have - * more advanced capabilities, such as dedicated secure co-processors which - * can stream and encrypt data over USB. In order to used enhanced messaging - * you must define PCSCLITE_ENHANCED_MESSAGING in the framework(library), - * the daemon, and your application - */ -#undef PCSCLITE_ENHANCED_MESSAGING -#ifndef PCSCLITE_ENHANCED_MESSAGING -#define PCSCLITE_MAX_MESSAGE_SIZE 2048 /* Transport msg len */ -#define MAX_BUFFER_SIZE 264 /* Maximum Tx/Rx Buffer */ -#define PCSCLITE_SERVER_ATTEMPTS 5 /* Attempts to reach cl */ -#else -/* * The message and buffer sizes must be multiples of 16. * The max message size must be at least large enough - * to accommodate the transmit_struct + * to accomodate the transmit_struct */ -#define PCSCLITE_MAX_MESSAGE_SIZE (1<<17) /* enhanced (128K) msg len */ -#define MAX_BUFFER_SIZE (1<<15) /* enhanced (32K) Tx/Rx Buffer */ -#define PCSCLITE_SERVER_ATTEMPTS 200 /* To allow larger data reads/writes */ -#endif +#define MAX_BUFFER_SIZE 264 /**< Maximum Tx/Rx Buffer for short APDU */ +#define MAX_BUFFER_SIZE_EXTENDED (4 + 3 + (1<<16) + 3 + 2) /**< enhanced (64K + APDU + Lc + Le + SW) Tx/Rx Buffer */ /* * Gets a stringified error response */ -char *pcsc_stringify_error(long); +const char *pcsc_stringify_error(const LONG); #ifdef __cplusplus }
--- a/src/solaris/native/sun/security/smartcardio/MUSCLE/winscard.h Mon Sep 09 17:27:04 2019 +0100 +++ b/src/solaris/native/sun/security/smartcardio/MUSCLE/winscard.h Wed Oct 23 15:35:04 2019 +0100 @@ -1,13 +1,38 @@ /* - * This handles smartcard reader communications. - * - * MUSCLE SmartCard Development ( http://www.linuxnet.com ) + * MUSCLE SmartCard Development ( https://pcsclite.apdu.fr/ ) * * Copyright (C) 1999-2003 - * David Corcoran <corcoran@linuxnet.com> + * David Corcoran <corcoran@musclecard.com> + * Copyright (C) 2002-2009 * Ludovic Rousseau <ludovic.rousseau@free.fr> * - * $Id: winscard.h,v 1.13 2004/08/06 12:12:19 rousseau Exp $ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * @brief This handles smart card reader communications. */ #ifndef __winscard_h__ @@ -20,71 +45,79 @@ { #endif - LONG SCardEstablishContext(DWORD dwScope, - LPCVOID pvReserved1, LPCVOID pvReserved2, LPSCARDCONTEXT phContext); - - LONG SCardReleaseContext(SCARDCONTEXT hContext); +#ifndef PCSC_API +#define PCSC_API +#endif - LONG SCardSetTimeout(SCARDCONTEXT hContext, DWORD dwTimeout); + PCSC_API LONG SCardEstablishContext(DWORD dwScope, + /*@null@*/ LPCVOID pvReserved1, /*@null@*/ LPCVOID pvReserved2, + /*@out@*/ LPSCARDCONTEXT phContext); - LONG SCardConnect(SCARDCONTEXT hContext, - LPCTSTR szReader, - DWORD dwShareMode, - DWORD dwPreferredProtocols, - LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol); + PCSC_API LONG SCardReleaseContext(SCARDCONTEXT hContext); + + PCSC_API LONG SCardIsValidContext(SCARDCONTEXT hContext); - LONG SCardReconnect(SCARDHANDLE hCard, - DWORD dwShareMode, - DWORD dwPreferredProtocols, - DWORD dwInitialization, LPDWORD pdwActiveProtocol); + PCSC_API LONG SCardConnect(SCARDCONTEXT hContext, + LPCSTR szReader, + DWORD dwShareMode, + DWORD dwPreferredProtocols, + /*@out@*/ LPSCARDHANDLE phCard, /*@out@*/ LPDWORD pdwActiveProtocol); - LONG SCardDisconnect(SCARDHANDLE hCard, DWORD dwDisposition); - - LONG SCardBeginTransaction(SCARDHANDLE hCard); + PCSC_API LONG SCardReconnect(SCARDHANDLE hCard, + DWORD dwShareMode, + DWORD dwPreferredProtocols, + DWORD dwInitialization, /*@out@*/ LPDWORD pdwActiveProtocol); - LONG SCardEndTransaction(SCARDHANDLE hCard, DWORD dwDisposition); + PCSC_API LONG SCardDisconnect(SCARDHANDLE hCard, DWORD dwDisposition); - LONG SCardCancelTransaction(SCARDHANDLE hCard); + PCSC_API LONG SCardBeginTransaction(SCARDHANDLE hCard); + + PCSC_API LONG SCardEndTransaction(SCARDHANDLE hCard, DWORD dwDisposition); - LONG SCardStatus(SCARDHANDLE hCard, - LPTSTR mszReaderNames, LPDWORD pcchReaderLen, - LPDWORD pdwState, - LPDWORD pdwProtocol, - LPBYTE pbAtr, LPDWORD pcbAtrLen); + PCSC_API LONG SCardStatus(SCARDHANDLE hCard, + /*@null@*/ /*@out@*/ LPSTR mszReaderName, + /*@null@*/ /*@out@*/ LPDWORD pcchReaderLen, + /*@null@*/ /*@out@*/ LPDWORD pdwState, + /*@null@*/ /*@out@*/ LPDWORD pdwProtocol, + /*@null@*/ /*@out@*/ LPBYTE pbAtr, + /*@null@*/ /*@out@*/ LPDWORD pcbAtrLen); - LONG SCardGetStatusChange(SCARDCONTEXT hContext, - DWORD dwTimeout, - LPSCARD_READERSTATE_A rgReaderStates, DWORD cReaders); + PCSC_API LONG SCardGetStatusChange(SCARDCONTEXT hContext, + DWORD dwTimeout, + SCARD_READERSTATE *rgReaderStates, DWORD cReaders); - LONG SCardControl(SCARDHANDLE hCard, DWORD dwControlCode, - LPCVOID pbSendBuffer, DWORD cbSendLength, - LPVOID pbRecvBuffer, DWORD cbRecvLength, LPDWORD lpBytesReturned); + PCSC_API LONG SCardControl(SCARDHANDLE hCard, DWORD dwControlCode, + LPCVOID pbSendBuffer, DWORD cbSendLength, + /*@out@*/ LPVOID pbRecvBuffer, DWORD cbRecvLength, + LPDWORD lpBytesReturned); - LONG SCardTransmit(SCARDHANDLE hCard, - LPCSCARD_IO_REQUEST pioSendPci, - LPCBYTE pbSendBuffer, DWORD cbSendLength, - LPSCARD_IO_REQUEST pioRecvPci, - LPBYTE pbRecvBuffer, LPDWORD pcbRecvLength); + PCSC_API LONG SCardTransmit(SCARDHANDLE hCard, + const SCARD_IO_REQUEST *pioSendPci, + LPCBYTE pbSendBuffer, DWORD cbSendLength, + /*@out@*/ SCARD_IO_REQUEST *pioRecvPci, + /*@out@*/ LPBYTE pbRecvBuffer, LPDWORD pcbRecvLength); - LONG SCardListReaderGroups(SCARDCONTEXT hContext, - LPTSTR mszGroups, LPDWORD pcchGroups); + PCSC_API LONG SCardListReaderGroups(SCARDCONTEXT hContext, + /*@out@*/ LPSTR mszGroups, LPDWORD pcchGroups); - LONG SCardListReaders(SCARDCONTEXT hContext, - LPCTSTR mszGroups, - LPTSTR mszReaders, LPDWORD pcchReaders); + PCSC_API LONG SCardListReaders(SCARDCONTEXT hContext, + /*@null@*/ /*@out@*/ LPCSTR mszGroups, + /*@null@*/ /*@out@*/ LPSTR mszReaders, + /*@out@*/ LPDWORD pcchReaders); - LONG SCardCancel(SCARDCONTEXT hContext); + PCSC_API LONG SCardFreeMemory(SCARDCONTEXT hContext, LPCVOID pvMem); - LONG SCardGetAttrib(SCARDHANDLE hCard, DWORD dwAttrId, LPBYTE pbAttr, - LPDWORD pcbAttrLen); + PCSC_API LONG SCardCancel(SCARDCONTEXT hContext); - LONG SCardSetAttrib(SCARDHANDLE hCard, DWORD dwAttrId, LPCBYTE pbAttr, - DWORD cbAttrLen); + PCSC_API LONG SCardGetAttrib(SCARDHANDLE hCard, DWORD dwAttrId, + /*@out@*/ LPBYTE pbAttr, LPDWORD pcbAttrLen); - void SCardUnload(void); + PCSC_API LONG SCardSetAttrib(SCARDHANDLE hCard, DWORD dwAttrId, + LPCBYTE pbAttr, DWORD cbAttrLen); #ifdef __cplusplus } #endif #endif +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/solaris/native/sun/security/smartcardio/MUSCLE/wintypes.h Wed Oct 23 15:35:04 2019 +0100 @@ -0,0 +1,115 @@ +/* + * MUSCLE SmartCard Development ( https://pcsclite.apdu.fr/ ) + * + * Copyright (C) 1999 + * David Corcoran <corcoran@musclecard.com> + * Copyright (C) 2002-2011 + * Ludovic Rousseau <ludovic.rousseau@free.fr> + * +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * @brief This keeps a list of Windows(R) types. + */ + +#ifndef __wintypes_h__ +#define __wintypes_h__ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifdef __APPLE__ + +#include <stdint.h> + +#ifndef BYTE + typedef uint8_t BYTE; +#endif + typedef uint8_t UCHAR; + typedef UCHAR *PUCHAR; + typedef uint16_t USHORT; + +#ifndef __COREFOUNDATION_CFPLUGINCOM__ + typedef uint32_t ULONG; + typedef void *LPVOID; + typedef int16_t BOOL; +#endif + + typedef ULONG *PULONG; + typedef const void *LPCVOID; + typedef uint32_t DWORD; + typedef DWORD *PDWORD; + typedef uint16_t WORD; + typedef int32_t LONG; + typedef const char *LPCSTR; + typedef const BYTE *LPCBYTE; + typedef BYTE *LPBYTE; + typedef DWORD *LPDWORD; + typedef char *LPSTR; + +#else + +#ifndef BYTE + typedef unsigned char BYTE; +#endif + typedef unsigned char UCHAR; + typedef UCHAR *PUCHAR; + typedef unsigned short USHORT; + +#ifndef __COREFOUNDATION_CFPLUGINCOM__ + typedef unsigned long ULONG; + typedef void *LPVOID; +#endif + + typedef const void *LPCVOID; + typedef unsigned long DWORD; + typedef DWORD *PDWORD; + typedef long LONG; + typedef const char *LPCSTR; + typedef const BYTE *LPCBYTE; + typedef BYTE *LPBYTE; + typedef DWORD *LPDWORD; + typedef char *LPSTR; + + /* these types were deprecated but still used by old drivers and + * applications. So just declare and use them. */ + typedef LPSTR LPTSTR; + typedef LPCSTR LPCTSTR; + + /* types unused by pcsc-lite */ + typedef short BOOL; + typedef unsigned short WORD; + typedef ULONG *PULONG; + +#endif + +#ifdef __cplusplus +} +#endif + +#endif
--- a/src/solaris/native/sun/security/smartcardio/pcsc_md.h Mon Sep 09 17:27:04 2019 +0100 +++ b/src/solaris/native/sun/security/smartcardio/pcsc_md.h Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2019, 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 @@ -25,48 +25,49 @@ #ifndef USE_SYSTEM_PCSC -typedef LONG (*FPTR_SCardEstablishContext)(ULONG dwScope, - const void *pvReserved1, - const void *pvReserved2, - LONG *phContext); +typedef LONG (*FPTR_SCardEstablishContext)(DWORD dwScope, + LPCVOID pvReserved1, + LPCVOID pvReserved2, + LPSCARDCONTEXT phContext); -typedef LONG (*FPTR_SCardConnect)(LONG hContext, - const char *szReader, - ULONG dwShareMode, - ULONG dwPreferredProtocols, - LONG *phCard, ULONG *pdwActiveProtocol); +typedef LONG (*FPTR_SCardConnect)(SCARDCONTEXT hContext, + LPCSTR szReader, + DWORD dwShareMode, + DWORD dwPreferredProtocols, + LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol); -typedef LONG (*FPTR_SCardDisconnect)(LONG hCard, ULONG dwDisposition); +typedef LONG (*FPTR_SCardDisconnect)(SCARDHANDLE hCard, DWORD dwDisposition); -typedef LONG (*FPTR_SCardStatus)(LONG hCard, - char *mszReaderNames, - ULONG *pcchReaderLen, - ULONG *pdwState, - ULONG *pdwProtocol, - unsigned char *pbAtr, ULONG *pcbAtrLen); +typedef LONG (*FPTR_SCardStatus)(SCARDHANDLE hCard, + LPSTR mszReaderNames, + LPDWORD pcchReaderLen, + LPDWORD pdwState, + LPDWORD pdwProtocol, + LPBYTE pbAtr, LPDWORD pcbAtrLen); -typedef LONG (*FPTR_SCardGetStatusChange)(LONG hContext, - ULONG dwTimeout, - LPSCARD_READERSTATE_A rgReaderStates, ULONG cReaders); +typedef LONG (*FPTR_SCardGetStatusChange)(SCARDCONTEXT hContext, + DWORD dwTimeout, + SCARD_READERSTATE *rgReaderStates, DWORD cReaders); -typedef LONG (*FPTR_SCardTransmit)(LONG hCard, - LPCSCARD_IO_REQUEST pioSendPci, - const unsigned char *pbSendBuffer, - ULONG cbSendLength, - LPSCARD_IO_REQUEST pioRecvPci, - unsigned char *pbRecvBuffer, ULONG *pcbRecvLength); +typedef LONG (*FPTR_SCardTransmit)(SCARDHANDLE hCard, + const SCARD_IO_REQUEST *pioSendPci, + LPCBYTE pbSendBuffer, + DWORD cbSendLength, + SCARD_IO_REQUEST *pioRecvPci, + LPBYTE pbRecvBuffer, LPDWORD pcbRecvLength); -typedef LONG (*FPTR_SCardListReaders)(LONG hContext, - const char *mszGroups, - char *mszReaders, ULONG *pcchReaders); +typedef LONG (*FPTR_SCardListReaders)(SCARDCONTEXT hContext, + LPCSTR mszGroups, + LPSTR mszReaders, LPDWORD pcchReaders); -typedef LONG (*FPTR_SCardBeginTransaction)(LONG hCard); +typedef LONG (*FPTR_SCardBeginTransaction)(SCARDHANDLE hCard); -typedef LONG (*FPTR_SCardEndTransaction)(LONG hCard, ULONG dwDisposition); +typedef LONG (*FPTR_SCardEndTransaction)(SCARDHANDLE hCard, + DWORD dwDisposition); -typedef LONG (*FPTR_SCardControl)(LONG hCard, ULONG dwControlCode, - const void* pbSendBuffer, ULONG cbSendLength, const void* pbRecvBuffer, - ULONG pcbRecvLength, ULONG *lpBytesReturned); +typedef LONG (*FPTR_SCardControl)(SCARDHANDLE hCard, DWORD dwControlCode, + LPCVOID pbSendBuffer, DWORD cbSendLength, LPVOID pbRecvBuffer, + DWORD pcbRecvLength, LPDWORD lpBytesReturned); #define CALL_SCardEstablishContext(dwScope, pvReserved1, pvReserved2, phContext) \ ((scardEstablishContext)(dwScope, pvReserved1, pvReserved2, phContext))
--- a/src/windows/classes/java/lang/ProcessImpl.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/windows/classes/java/lang/ProcessImpl.java Wed Oct 23 15:35:04 2019 +0100 @@ -38,9 +38,11 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.util.ArrayList; +import java.util.Locale; import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; +import sun.security.action.GetPropertyAction; /* This class is for the exclusive use of ProcessBuilder.start() to * create new processes. @@ -172,12 +174,15 @@ private static final int VERIFICATION_CMD_BAT = 0; private static final int VERIFICATION_WIN32 = 1; - private static final int VERIFICATION_LEGACY = 2; + private static final int VERIFICATION_WIN32_SAFE = 2; // inside quotes not allowed + private static final int VERIFICATION_LEGACY = 3; + // See Command shell overview for documentation of special characters. + // https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-xp/bb490954(v=technet.10) private static final char ESCAPE_VERIFICATION[][] = { // We guarantee the only command file execution for implicit [cmd.exe] run. // http://technet.microsoft.com/en-us/library/bb490954.aspx {' ', '\t', '<', '>', '&', '|', '^'}, - + {' ', '\t', '<', '>'}, {' ', '\t', '<', '>'}, {' ', '\t'} }; @@ -194,8 +199,25 @@ cmdbuf.append(' '); String s = cmd[i]; if (needsEscaping(verificationType, s)) { - cmdbuf.append('"').append(s); + cmdbuf.append('"'); + if (verificationType == VERIFICATION_WIN32_SAFE) { + // Insert the argument, adding '\' to quote any interior quotes + int length = s.length(); + for (int j = 0; j < length; j++) { + char c = s.charAt(j); + if (c == DOUBLEQUOTE) { + int count = countLeadingBackslash(verificationType, s, j); + while (count-- > 0) { + cmdbuf.append(BACKSLASH); // double the number of backslashes + } + cmdbuf.append(BACKSLASH); // backslash to quote the quote + } + cmdbuf.append(c); + } + } else { + cmdbuf.append(s); + } // The code protects the [java.exe] and console command line // parser, that interprets the [\"] combination as an escape // sequence for the ["] char. @@ -208,8 +230,9 @@ // command line parser. The case of the [""] tail escape // sequence could not be realized due to the argument validation // procedure. - if ((verificationType != VERIFICATION_CMD_BAT) && s.endsWith("\\")) { - cmdbuf.append('\\'); + int count = countLeadingBackslash(verificationType, s, s.length()); + while (count-- > 0) { + cmdbuf.append(BACKSLASH); // double the number of backslashes } cmdbuf.append('"'); } else { @@ -219,26 +242,16 @@ return cmdbuf.toString(); } - private static boolean isQuoted(boolean noQuotesInside, String arg, - String errorMessage) { - int lastPos = arg.length() - 1; - if (lastPos >=1 && arg.charAt(0) == '"' && arg.charAt(lastPos) == '"') { - // The argument has already been quoted. - if (noQuotesInside) { - if (arg.indexOf('"', 1) != lastPos) { - // There is ["] inside. - throw new IllegalArgumentException(errorMessage); - } - } - return true; - } - if (noQuotesInside) { - if (arg.indexOf('"') >= 0) { - // There is ["] inside. - throw new IllegalArgumentException(errorMessage); - } - } - return false; + /** + * Return the argument without quotes (1st and last) if present, else the arg. + * @param str a string + * @return the string without 1st and last quotes + */ + private static String unQuote(String str) { + int len = str.length(); + return (len >= 2 && str.charAt(0) == DOUBLEQUOTE && str.charAt(len - 1) == DOUBLEQUOTE) + ? str.substring(1, len - 1) + : str; } private static boolean needsEscaping(int verificationType, String arg) { @@ -249,9 +262,26 @@ // For [.exe] or [.com] file the unpaired/internal ["] // in the argument is not a problem. - boolean argIsQuoted = isQuoted( - (verificationType == VERIFICATION_CMD_BAT), - arg, "Argument has embedded quote, use the explicit CMD.EXE call."); + String unquotedArg = unQuote(arg); + boolean argIsQuoted = !arg.equals(unquotedArg); + boolean embeddedQuote = unquotedArg.indexOf(DOUBLEQUOTE) >= 0; + + switch (verificationType) { + case VERIFICATION_CMD_BAT: + if (embeddedQuote) { + throw new IllegalArgumentException("Argument has embedded quote, " + + "use the explicit CMD.EXE call."); + } + break; // break determine whether to quote + case VERIFICATION_WIN32_SAFE: + if (argIsQuoted && embeddedQuote) { + throw new IllegalArgumentException("Malformed argument has embedded quote: " + + unquotedArg); + } + break; + default: + break; + } if (!argIsQuoted) { char testEscape[] = ESCAPE_VERIFICATION[verificationType]; @@ -267,13 +297,13 @@ private static String getExecutablePath(String path) throws IOException { - boolean pathIsQuoted = isQuoted(true, path, - "Executable name has embedded quote, split the arguments"); - + String name = unQuote(path); + if (name.indexOf(DOUBLEQUOTE) >= 0) { + throw new IllegalArgumentException("Executable name has embedded quote, " + + "split the arguments: " + name); + } // Win32 CreateProcess requires path to be normalized - File fileToRun = new File(pathIsQuoted - ? path.substring(1, path.length() - 1) - : path); + File fileToRun = new File(name); // From the [CreateProcess] function documentation: // @@ -288,13 +318,26 @@ // sequence:..." // // In practice ANY non-existent path is extended by [.exe] extension - // in the [CreateProcess] funcion with the only exception: + // in the [CreateProcess] function with the only exception: // the path ends by (.) return fileToRun.getPath(); } + /** + * An executable is any program that is an EXE or does not have an extension + * and the Windows createProcess will be looking for .exe. + * The comparison is case insensitive based on the name. + * @param executablePath the executable file + * @return true if the path ends in .exe or does not have an extension. + */ + private boolean isExe(String executablePath) { + File file = new File(executablePath); + String upName = file.getName().toUpperCase(Locale.ROOT); + return (upName.endsWith(".EXE") || upName.indexOf('.') < 0); + } + // Old version that can be bypassed private boolean isShellFile(String executablePath) { String upPath = executablePath.toUpperCase(); return (upPath.endsWith(".CMD") || upPath.endsWith(".BAT")); @@ -305,6 +348,21 @@ return argbuf.append('"').append(arg).append('"').toString(); } + // Count backslashes before start index of string. + // .bat files don't include backslashes as part of the quote + private static int countLeadingBackslash(int verificationType, + CharSequence input, int start) { + if (verificationType == VERIFICATION_CMD_BAT) + return 0; + int j; + for (j = start - 1; j >= 0 && input.charAt(j) == BACKSLASH; j--) { + // just scanning backwards + } + return (start - 1) - j; // number of BACKSLASHES + } + + private static final char DOUBLEQUOTE = '\"'; + private static final char BACKSLASH = '\\'; private long handle = 0; private OutputStream stdin_stream; @@ -319,15 +377,14 @@ throws IOException { String cmdstr; - SecurityManager security = System.getSecurityManager(); - boolean allowAmbiguousCommands = false; - if (security == null) { - allowAmbiguousCommands = true; - String value = System.getProperty("jdk.lang.Process.allowAmbiguousCommands"); - if (value != null) - allowAmbiguousCommands = !"false".equalsIgnoreCase(value); - } - if (allowAmbiguousCommands) { + final SecurityManager security = System.getSecurityManager(); + String propertyValue = GetPropertyAction. + privilegedGetProperty("jdk.lang.Process.allowAmbiguousCommands"); + final String value = propertyValue != null ? propertyValue + : (security == null ? "true" : "false"); + final boolean allowAmbiguousCommands = !"false".equalsIgnoreCase(value); + + if (allowAmbiguousCommands && security == null) { // Legacy mode. // Normalize path if possible. @@ -374,11 +431,12 @@ // Quotation protects from interpretation of the [path] argument as // start of longer path with spaces. Quotation has no influence to // [.exe] extension heuristic. + boolean isShell = allowAmbiguousCommands ? isShellFile(executablePath) + : !isExe(executablePath); cmdstr = createCommandLine( - // We need the extended verification procedure for CMD files. - isShellFile(executablePath) - ? VERIFICATION_CMD_BAT - : VERIFICATION_WIN32, + // We need the extended verification procedures + isShell ? VERIFICATION_CMD_BAT + : (allowAmbiguousCommands ? VERIFICATION_WIN32 : VERIFICATION_WIN32_SAFE), quoteString(executablePath), cmd); }
--- a/src/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2019, 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 @@ -194,7 +194,17 @@ } } - static native boolean isTrustedSite(String url); + private static final boolean isTrustedSiteAvailable = isTrustedSiteAvailable(); + + private static native boolean isTrustedSiteAvailable(); + + private static boolean isTrustedSite(String url) { + if (isTrustedSiteAvailable) + return isTrustedSite0(url); + return false; + } + + private static native boolean isTrustedSite0(String url); /** * Not supported. Must use the setHeaders() method
--- a/src/windows/classes/sun/print/PrintServiceLookupProvider.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/windows/classes/sun/print/PrintServiceLookupProvider.java Wed Oct 23 15:35:04 2019 +0100 @@ -27,6 +27,8 @@ import java.security.AccessController; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; import javax.print.DocFlavor; import javax.print.MultiDocPrintService; import javax.print.PrintService; @@ -47,9 +49,11 @@ private PrintService defaultPrintService; private String[] printers; /* excludes the default printer */ private PrintService[] printServices; /* includes the default printer */ - private static boolean pollServices = true; - private static final int DEFAULT_MINREFRESH = 240; // 4 minutes - private static int minRefreshTime = DEFAULT_MINREFRESH; + + private static final int DEFAULT_REFRESH_TIME = 240; // 4 minutes + private static final int MINIMUM_REFRESH_TIME = 120; // 2 minutes + private static final boolean pollServices; + private static final int refreshTime; static { /* The system property "sun.java2d.print.polling" @@ -58,12 +62,7 @@ */ String pollStr = java.security.AccessController.doPrivileged( new sun.security.action.GetPropertyAction("sun.java2d.print.polling")); - - if (pollStr != null) { - if (pollStr.equalsIgnoreCase("false")) { - pollServices = false; - } - } + pollServices = !("false".equalsIgnoreCase(pollStr)); /* The system property "sun.java2d.print.minRefreshTime" * can be used to specify minimum refresh time (in seconds) @@ -72,17 +71,9 @@ String refreshTimeStr = java.security.AccessController.doPrivileged( new sun.security.action.GetPropertyAction( "sun.java2d.print.minRefreshTime")); - - if (refreshTimeStr != null) { - try { - minRefreshTime = Integer.parseInt(refreshTimeStr); - } catch (NumberFormatException e) { - // ignore - } - if (minRefreshTime < DEFAULT_MINREFRESH) { - minRefreshTime = DEFAULT_MINREFRESH; - } - } + refreshTime = (refreshTimeStr != null) + ? getRefreshTime(refreshTimeStr) + : DEFAULT_REFRESH_TIME; java.security.AccessController.doPrivileged( new java.security.PrivilegedAction<Void>() { @@ -93,6 +84,17 @@ }); } + private static int getRefreshTime(final String refreshTimeStr) { + try { + int minRefreshTime = Integer.parseInt(refreshTimeStr); + return (minRefreshTime < MINIMUM_REFRESH_TIME) + ? MINIMUM_REFRESH_TIME + : minRefreshTime; + } catch (NumberFormatException e) { + return DEFAULT_REFRESH_TIME; + } + } + /* The singleton win32 print lookup service. * Code that is aware of this field and wants to use it must first * see if its null, and if so instantiate it by calling a method such as @@ -394,61 +396,37 @@ count of printer status changes(add\remove) and based on it update the printers list. */ - class RemotePrinterChangeListener extends Thread { - private String[] prevRemotePrinters; - + class RemotePrinterChangeListener extends Thread implements Comparator<String>{ RemotePrinterChangeListener() { - prevRemotePrinters = getRemotePrintersNames(); } - private boolean doCompare(String[] str1, String[] str2) { - if (str1 == null && str2 == null) { - return false; - } else if (str1 == null || str2 == null) { - return true; - } - - if (str1.length != str2.length) { - return true; - } else { - for (int i = 0; i < str1.length; i++) { - for (int j = 0; j < str2.length; j++) { - // skip if both are nulls - if (str1[i] == null && str2[j] == null) { - continue; - } - - // return true if there is a 'difference' but - // no need to access the individual string - if (str1[i] == null || str2[j] == null) { - return true; - } - - // do comparison only if they are non-nulls - if (!str1[i].equals(str2[j])) { - return true; - } - } - } - } - - return false; + @Override + public int compare(String o1, String o2) { + return ((o1 == null) + ? ((o2 == null) ? 0 : 1) + : ((o2 == null) ? -1 : o1.compareTo(o2))); } @Override public void run() { // Init the list of remote printers - prevRemotePrinters = getRemotePrintersNames(); + String[] prevRemotePrinters = getRemotePrintersNames(); + if (prevRemotePrinters != null) { + Arrays.sort(prevRemotePrinters, this); + } while (true) { try { - Thread.sleep(minRefreshTime * 1000); + Thread.sleep(refreshTime * 1000); } catch (InterruptedException e) { break; } String[] currentRemotePrinters = getRemotePrintersNames(); - if (doCompare(prevRemotePrinters, currentRemotePrinters)) { + if (currentRemotePrinters != null) { + Arrays.sort(currentRemotePrinters, this); + } + if (!Arrays.equals(prevRemotePrinters, currentRemotePrinters)) { // The list of remote printers got updated, // so update the cached list printers which // includes both local and network printers
--- a/src/windows/classes/sun/security/krb5/internal/tools/Klist.java Mon Sep 09 17:27:04 2019 +0100 +++ b/src/windows/classes/sun/security/krb5/internal/tools/Klist.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, 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 @@ -31,6 +31,8 @@ package sun.security.krb5.internal.tools; import java.net.InetAddress; +import java.util.List; + import sun.security.krb5.*; import sun.security.krb5.internal.*; import sun.security.krb5.internal.ccache.*; @@ -241,6 +243,8 @@ String endtime; String renewTill; String servicePrincipal; + PrincipalName servicePrincipal2; + String clientPrincipal; if (creds[i].getStartTime() != null) { starttime = format(creds[i].getStartTime()); } else { @@ -252,6 +256,18 @@ System.out.println("[" + (i + 1) + "] " + " Service Principal: " + servicePrincipal); + servicePrincipal2 = + creds[i].getServicePrincipal2(); + if (servicePrincipal2 != null) { + System.out.println(" Second Service: " + + servicePrincipal2); + } + clientPrincipal = + creds[i].getClientPrincipal().toString(); + if (!clientPrincipal.equals(defaultPrincipal)) { + System.out.println(" Client Principal: " + + clientPrincipal); + } System.out.println(" Valid starting: " + starttime); System.out.println(" Expires: " + endtime); if (creds[i].getRenewTill() != null) { @@ -262,8 +278,15 @@ if (options[0] == 'e') { String eskey = EType.toString(creds[i].getEType()); String etkt = EType.toString(creds[i].getTktEType()); - System.out.println(" EType (skey, tkt): " - + eskey + ", " + etkt); + if (creds[i].getTktEType2() == 0) { + System.out.println(" EType (skey, tkt): " + + eskey + ", " + etkt); + } else { + String etkt2 = EType.toString(creds[i].getTktEType2()); + System.out.println(" EType (skey, tkts): " + + eskey + ", " + etkt + + ", " + etkt2); + } } if (options[1] == 'f') { System.out.println(" Flags: " + @@ -302,6 +325,15 @@ } else { System.out.println("\nNo entries found."); } + + List<CredentialsCache.ConfigEntry> configEntries + = cache.getConfigEntries(); + if (configEntries != null && !configEntries.isEmpty()) { + System.out.println("\nConfig entries:"); + for (CredentialsCache.ConfigEntry e : configEntries) { + System.out.println(" " + e); + } + } } void displayMessage(String target) {
--- a/src/windows/native/sun/java2d/d3d/D3DContext.cpp Mon Sep 09 17:27:04 2019 +0100 +++ b/src/windows/native/sun/java2d/d3d/D3DContext.cpp Wed Oct 23 15:35:04 2019 +0100 @@ -1156,7 +1156,9 @@ { #ifndef PtrAddBytes #define PtrAddBytes(p, b) ((void *) (((intptr_t) (p)) + (b))) -#define PtrCoord(p, x, xinc, y, yinc) PtrAddBytes(p, (y)*(yinc) + (x)*(xinc)) +#define PtrCoord(p, x, xinc, y, yinc) PtrAddBytes(p, \ + ((ptrdiff_t)(y))*(yinc) + \ + ((ptrdiff_t)(x))*(xinc)) #endif // PtrAddBytes HRESULT res = S_OK;
--- a/src/windows/native/sun/net/www/protocol/http/ntlm/NTLMAuthentication.c Mon Sep 09 17:27:04 2019 +0100 +++ b/src/windows/native/sun/net/www/protocol/http/ntlm/NTLMAuthentication.c Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ -26,11 +26,34 @@ #include <jni.h> #include <windows.h> #include "jni_util.h" +#include "jdk_util.h" #include <urlmon.h> -JNIEXPORT jboolean JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthentication_isTrustedSite(JNIEnv *env, jclass clazz, jstring url ) +typedef HRESULT (WINAPI *CoInternetCreateSecurityManagerType) + (IServiceProvider*,IInternetSecurityManager**,DWORD); + +static CoInternetCreateSecurityManagerType fn_CoInternetCreateSecurityManager; + +JNIEXPORT jboolean JNICALL +Java_sun_net_www_protocol_http_ntlm_NTLMAuthentication_isTrustedSiteAvailable + (JNIEnv *env, jclass clazz) { + HMODULE libUrlmon = JDK_LoadSystemLibrary("urlmon.dll"); + if (libUrlmon != NULL) { + fn_CoInternetCreateSecurityManager = (CoInternetCreateSecurityManagerType) + GetProcAddress(libUrlmon, "CoInternetCreateSecurityManager"); + if (fn_CoInternetCreateSecurityManager != NULL) { + return JNI_TRUE; + } + } + return JNI_FALSE; +} + +JNIEXPORT jboolean JNICALL +Java_sun_net_www_protocol_http_ntlm_NTLMAuthentication_isTrustedSite0 + (JNIEnv *env, jclass clazz, jstring url) +{ HRESULT hr; DWORD dwZone; DWORD pPolicy = 0; @@ -38,8 +61,11 @@ jboolean ret; LPCWSTR bstrURL; + if (fn_CoInternetCreateSecurityManager == NULL) + return JNI_FALSE; + // Create IInternetSecurityManager - hr = CoInternetCreateSecurityManager(NULL, &spSecurityManager, (DWORD)0); + hr = fn_CoInternetCreateSecurityManager(NULL, &spSecurityManager, (DWORD)0); if (FAILED(hr)) { return JNI_FALSE; }
--- a/test/Makefile Mon Sep 09 17:27:04 2019 +0100 +++ b/test/Makefile Wed Oct 23 15:35:04 2019 +0100 @@ -272,7 +272,7 @@ JTREG_ASSERT_OPTION = -ea -esa JTREG_BASIC_OPTIONS += $(JTREG_ASSERT_OPTION) # Report details on all failed or error tests, times too -JTREG_BASIC_OPTIONS += -v:fail,error,time +JTREG_BASIC_OPTIONS += -v:fail,error,summary # Retain all files for failing tests JTREG_BASIC_OPTIONS += -retain:fail,error # Ignore tests are not run and completely silent about it
--- a/test/TEST.groups Mon Sep 09 17:27:04 2019 +0100 +++ b/test/TEST.groups Wed Oct 23 15:35:04 2019 +0100 @@ -25,12 +25,13 @@ # Tiered testing definitions # -tier1 = \ +jdk_tier1 = \ :jdk_lang \ :jdk_util \ - :jdk_math + :jdk_math \ + :jdk_jdi -tier2 = \ +jdk_tier2 = \ :jdk_io \ :jdk_nio \ :jdk_net \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/FontClass/FontSize1Test.java Wed Oct 23 15:35:04 2019 +0100 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2019, 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. + * + * 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. + */ + +/* + * @test + * @bug 8216965 + * @summary verify no crash when rendering size 1 fonts + */ + +import java.awt.Font; +import java.awt.Graphics2D; +import java.awt.GraphicsEnvironment; +import java.awt.image.BufferedImage; + +public class FontSize1Test { + + static final String text = "abcdefghijklmnopqrstuvwxyz"; + + public static void main(String[] args) { + + BufferedImage bi = + new BufferedImage(100, 20, BufferedImage.TYPE_INT_RGB); + Graphics2D g2d = bi.createGraphics(); + Font af[] = + GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts(); + + for (Font f : af) { + System.out.println("Looking at font " + f); + g2d.setFont(f); + g2d.getFontMetrics().getWidths(); + g2d.drawString(text, 50, 10); + } + g2d.dispose(); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/image/DrawImage/IncorrectManagedImageSourceOffset.java Wed Oct 23 15:35:04 2019 +0100 @@ -0,0 +1,188 @@ +/* + * Copyright (c) 2014, 2019, 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. + * + * 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. + */ + +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsEnvironment; +import java.awt.Image; +import java.awt.Transparency; +import java.awt.color.ColorSpace; +import java.awt.image.BufferedImage; +import java.awt.image.ColorModel; +import java.awt.image.ComponentColorModel; +import java.awt.image.DataBuffer; +import java.awt.image.Raster; +import java.awt.image.VolatileImage; +import java.awt.image.WritableRaster; +import java.io.File; +import java.io.IOException; + +import javax.imageio.ImageIO; + +import sun.awt.image.SunWritableRaster; + +import static java.awt.Transparency.BITMASK; +import static java.awt.Transparency.OPAQUE; +import static java.awt.Transparency.TRANSLUCENT; +import static java.awt.image.BufferedImage.TYPE_3BYTE_BGR; +import static java.awt.image.BufferedImage.TYPE_4BYTE_ABGR; +import static java.awt.image.BufferedImage.TYPE_4BYTE_ABGR_PRE; +import static java.awt.image.BufferedImage.TYPE_BYTE_BINARY; +import static java.awt.image.BufferedImage.TYPE_BYTE_INDEXED; +import static java.awt.image.BufferedImage.TYPE_CUSTOM; +import static java.awt.image.BufferedImage.TYPE_INT_ARGB; +import static java.awt.image.BufferedImage.TYPE_INT_ARGB_PRE; +import static java.awt.image.BufferedImage.TYPE_INT_BGR; +import static java.awt.image.BufferedImage.TYPE_INT_RGB; + +/** + * @test + * @key headful + * @bug 8029253 6207877 + * @summary Tests asymmetric source offsets when managed image is drawn to VI. + * Results of the blit to compatibleImage are used for comparison. + * @author Sergey Bylokhov + * @modules java.desktop/sun.awt.image + * @run main/othervm -Dsun.java2d.accthreshold=0 IncorrectManagedImageSourceOffset + * @run main/othervm -Dsun.java2d.accthreshold=0 -Dsun.java2d.uiScale=1 IncorrectManagedImageSourceOffset + * @run main/othervm -Dsun.java2d.accthreshold=0 -Dsun.java2d.uiScale=2 IncorrectManagedImageSourceOffset + */ +public final class IncorrectManagedImageSourceOffset { + + // See the same test for unmanaged images: IncorrectUnmanagedImageSourceOffset + + private static final int[] TYPES = {TYPE_INT_RGB, TYPE_INT_ARGB, + TYPE_INT_ARGB_PRE, TYPE_INT_BGR, + TYPE_3BYTE_BGR, TYPE_4BYTE_ABGR, + TYPE_4BYTE_ABGR_PRE, + /*TYPE_USHORT_565_RGB, + TYPE_USHORT_555_RGB, TYPE_BYTE_GRAY, + TYPE_USHORT_GRAY,*/ TYPE_BYTE_BINARY, + TYPE_BYTE_INDEXED, TYPE_CUSTOM}; + private static final int[] TRANSPARENCIES = {OPAQUE, BITMASK, TRANSLUCENT}; + + public static void main(final String[] args) throws IOException { + for (final int viType : TRANSPARENCIES) { + for (final int biType : TYPES) { + BufferedImage bi = makeManagedBI(biType); + fill(bi); + test(bi, viType); + } + } + } + + private static void test(BufferedImage bi, int type) + throws IOException { + GraphicsEnvironment ge = GraphicsEnvironment + .getLocalGraphicsEnvironment(); + GraphicsConfiguration gc = ge.getDefaultScreenDevice() + .getDefaultConfiguration(); + VolatileImage vi = gc.createCompatibleVolatileImage(511, 255, type); + BufferedImage gold = gc.createCompatibleImage(511, 255, type); + // draw to compatible Image + Graphics2D big = gold.createGraphics(); + // force scaled blit + big.drawImage(bi, 7, 11, 127, 111, 7, 11, 127 * 2, 111, null); + big.dispose(); + // draw to volatile image + BufferedImage snapshot; + while (true) { + vi.validate(gc); + if (vi.validate(gc) != VolatileImage.IMAGE_OK) { + try { + Thread.sleep(100); + } catch (final InterruptedException ignored) { + } + continue; + } + Graphics2D vig = vi.createGraphics(); + // force scaled blit + vig.drawImage(bi, 7, 11, 127, 111, 7, 11, 127 * 2, 111, null); + vig.dispose(); + snapshot = vi.getSnapshot(); + if (vi.contentsLost()) { + try { + Thread.sleep(100); + } catch (final InterruptedException ignored) { + } + continue; + } + break; + } + // validate images + for (int x = 7; x < 127; ++x) { + for (int y = 11; y < 111; ++y) { + if (gold.getRGB(x, y) != snapshot.getRGB(x, y)) { + ImageIO.write(gold, "png", new File("gold.png")); + ImageIO.write(snapshot, "png", new File("bi.png")); + throw new RuntimeException("Test failed."); + } + } + } + } + + private static BufferedImage makeManagedBI(final int type) { + final BufferedImage bi; + if (type == TYPE_CUSTOM) { + bi = makeCustomManagedBI(); + } else { + bi = new BufferedImage(511, 255, type); + } + bi.setAccelerationPriority(1.0f); + return bi; + } + + /** + * Returns the custom buffered image, which mostly identical to + * BufferedImage.(w,h,TYPE_3BYTE_BGR), but uses the bigger scanlineStride. + * This means that the raster will have gaps, between the rows. + */ + private static BufferedImage makeCustomManagedBI() { + int w = 511, h = 255; + ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB); + int[] nBits = {8, 8, 8}; + int[] bOffs = {2, 1, 0}; + ColorModel colorModel = new ComponentColorModel(cs, nBits, false, false, + Transparency.OPAQUE, + DataBuffer.TYPE_BYTE); + WritableRaster raster = + Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, w, h, + w * 3 + 2, 3, bOffs, null); + BufferedImage bi = new BufferedImage(colorModel, raster, true, null); + SunWritableRaster.makeTrackable(raster.getDataBuffer()); + SunWritableRaster.markDirty(bi); + return bi; + } + + private static void fill(final Image image) { + final Graphics2D graphics = (Graphics2D) image.getGraphics(); + graphics.setComposite(AlphaComposite.Src); + for (int i = 0; i < image.getHeight(null); ++i) { + graphics.setColor(new Color(i, 0, 0)); + graphics.fillRect(0, i, image.getWidth(null), 1); + } + graphics.dispose(); + } +}
--- a/test/java/awt/image/DrawImage/IncorrectUnmanagedImageSourceOffset.java Mon Sep 09 17:27:04 2019 +0100 +++ b/test/java/awt/image/DrawImage/IncorrectUnmanagedImageSourceOffset.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2019, 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 @@ -27,30 +27,52 @@ import java.awt.GraphicsConfiguration; import java.awt.GraphicsEnvironment; import java.awt.Image; +import java.awt.Transparency; +import java.awt.color.ColorSpace; import java.awt.image.BufferedImage; +import java.awt.image.ColorModel; +import java.awt.image.ComponentColorModel; import java.awt.image.DataBuffer; import java.awt.image.DataBufferByte; import java.awt.image.DataBufferInt; import java.awt.image.DataBufferShort; +import java.awt.image.Raster; import java.awt.image.VolatileImage; +import java.awt.image.WritableRaster; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; -import static java.awt.Transparency.*; -import static java.awt.image.BufferedImage.*; +import static java.awt.Transparency.BITMASK; +import static java.awt.Transparency.OPAQUE; +import static java.awt.Transparency.TRANSLUCENT; +import static java.awt.image.BufferedImage.TYPE_3BYTE_BGR; +import static java.awt.image.BufferedImage.TYPE_4BYTE_ABGR; +import static java.awt.image.BufferedImage.TYPE_4BYTE_ABGR_PRE; +import static java.awt.image.BufferedImage.TYPE_BYTE_BINARY; +import static java.awt.image.BufferedImage.TYPE_BYTE_INDEXED; +import static java.awt.image.BufferedImage.TYPE_CUSTOM; +import static java.awt.image.BufferedImage.TYPE_INT_ARGB; +import static java.awt.image.BufferedImage.TYPE_INT_ARGB_PRE; +import static java.awt.image.BufferedImage.TYPE_INT_BGR; +import static java.awt.image.BufferedImage.TYPE_INT_RGB; /** * @test * @key headful - * @bug 8029253 + * @bug 8029253 6207877 * @summary Tests asymmetric source offsets when unmanaged image is drawn to VI. * Results of the blit to compatibleImage are used for comparison. * @author Sergey Bylokhov + * @run main/othervm IncorrectUnmanagedImageSourceOffset + * @run main/othervm -Dsun.java2d.uiScale=1 IncorrectUnmanagedImageSourceOffset + * @run main/othervm -Dsun.java2d.uiScale=2 IncorrectUnmanagedImageSourceOffset */ public final class IncorrectUnmanagedImageSourceOffset { + // See the same test for managed images: IncorrectManagedImageSourceOffset + private static final int[] TYPES = {TYPE_INT_RGB, TYPE_INT_ARGB, TYPE_INT_ARGB_PRE, TYPE_INT_BGR, TYPE_3BYTE_BGR, TYPE_4BYTE_ABGR, @@ -58,7 +80,7 @@ /*TYPE_USHORT_565_RGB, TYPE_USHORT_555_RGB, TYPE_BYTE_GRAY, TYPE_USHORT_GRAY,*/ TYPE_BYTE_BINARY, - TYPE_BYTE_INDEXED}; + TYPE_BYTE_INDEXED, TYPE_CUSTOM}; private static final int[] TRANSPARENCIES = {OPAQUE, BITMASK, TRANSLUCENT}; public static void main(final String[] args) throws IOException { @@ -122,7 +144,12 @@ } private static BufferedImage makeUnmanagedBI(final int type) { - final BufferedImage bi = new BufferedImage(511, 255, type); + final BufferedImage bi; + if (type == TYPE_CUSTOM) { + bi = makeCustomUnmanagedBI(); + } else { + bi = new BufferedImage(511, 255, type); + } final DataBuffer db = bi.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); @@ -130,15 +157,30 @@ ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); - } else { - try { - bi.setAccelerationPriority(0.0f); - } catch (final Throwable ignored) { - } } + bi.setAccelerationPriority(0.0f); return bi; } + /** + * Returns the custom buffered image, which mostly identical to + * BufferedImage.(w,h,TYPE_3BYTE_BGR), but uses the bigger scanlineStride. + * This means that the raster will have gaps, between the rows. + */ + private static BufferedImage makeCustomUnmanagedBI() { + int w = 511, h = 255; + ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB); + int[] nBits = {8, 8, 8}; + int[] bOffs = {2, 1, 0}; + ColorModel colorModel = new ComponentColorModel(cs, nBits, false, false, + Transparency.OPAQUE, + DataBuffer.TYPE_BYTE); + WritableRaster raster = + Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, w, h, + w * 3 + 2, 3, bOffs, null); + return new BufferedImage(colorModel, raster, true, null); + } + private static void fill(final Image image) { final Graphics2D graphics = (Graphics2D) image.getGraphics(); graphics.setComposite(AlphaComposite.Src);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/image/DrawImage/SimpleManagedImage.java Wed Oct 23 15:35:04 2019 +0100 @@ -0,0 +1,196 @@ +/* + * Copyright (c) 2014, 2019, 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. + * + * 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. + */ + +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsEnvironment; +import java.awt.Image; +import java.awt.Transparency; +import java.awt.color.ColorSpace; +import java.awt.image.BufferedImage; +import java.awt.image.ColorModel; +import java.awt.image.ComponentColorModel; +import java.awt.image.DataBuffer; +import java.awt.image.Raster; +import java.awt.image.VolatileImage; +import java.awt.image.WritableRaster; +import java.io.File; +import java.io.IOException; + +import javax.imageio.ImageIO; + +import sun.awt.image.SunWritableRaster; + +import static java.awt.Transparency.BITMASK; +import static java.awt.Transparency.OPAQUE; +import static java.awt.Transparency.TRANSLUCENT; +import static java.awt.image.BufferedImage.TYPE_3BYTE_BGR; +import static java.awt.image.BufferedImage.TYPE_4BYTE_ABGR; +import static java.awt.image.BufferedImage.TYPE_4BYTE_ABGR_PRE; +import static java.awt.image.BufferedImage.TYPE_BYTE_BINARY; +import static java.awt.image.BufferedImage.TYPE_BYTE_INDEXED; +import static java.awt.image.BufferedImage.TYPE_CUSTOM; +import static java.awt.image.BufferedImage.TYPE_INT_ARGB; +import static java.awt.image.BufferedImage.TYPE_INT_ARGB_PRE; +import static java.awt.image.BufferedImage.TYPE_INT_BGR; +import static java.awt.image.BufferedImage.TYPE_INT_RGB; + +/** + * @test + * @key headful + * @bug 8029253 6207877 + * @summary Tests the case when managed image is drawn to VI. + * Results of the blit to compatibleImage are used for comparison. + * @author Sergey Bylokhov + * @modules java.desktop/sun.awt.image + * @run main/othervm -Dsun.java2d.accthreshold=0 SimpleManagedImage + * @run main/othervm -Dsun.java2d.accthreshold=0 -Dsun.java2d.uiScale=1 SimpleManagedImage + * @run main/othervm -Dsun.java2d.accthreshold=0 -Dsun.java2d.uiScale=2 SimpleManagedImage + */ +public final class SimpleManagedImage { + + // See the same test for unmanaged images: SimpleUnmanagedImage + + private static final int[] TYPES = {TYPE_INT_RGB, TYPE_INT_ARGB, + TYPE_INT_ARGB_PRE, TYPE_INT_BGR, + TYPE_3BYTE_BGR, TYPE_4BYTE_ABGR, + TYPE_4BYTE_ABGR_PRE, + /*TYPE_USHORT_565_RGB, + TYPE_USHORT_555_RGB, TYPE_BYTE_GRAY, + TYPE_USHORT_GRAY,*/ TYPE_BYTE_BINARY, + TYPE_BYTE_INDEXED, TYPE_CUSTOM}; + private static final int[] TRANSPARENCIES = {OPAQUE, BITMASK, TRANSLUCENT}; + + public static void main(final String[] args) throws IOException { + for (final int viType : TRANSPARENCIES) { + for (final int biType : TYPES) { + BufferedImage bi = makeManagedBI(biType); + fill(bi); + test(bi, viType); + } + } + } + + private static void test(BufferedImage bi, int type) + throws IOException { + GraphicsEnvironment ge = GraphicsEnvironment + .getLocalGraphicsEnvironment(); + GraphicsConfiguration gc = ge.getDefaultScreenDevice() + .getDefaultConfiguration(); + VolatileImage vi = gc.createCompatibleVolatileImage(1000, 1000, type); + BufferedImage gold = gc.createCompatibleImage(1000, 1000, type); + // draw to compatible Image + init(gold); + Graphics2D big = gold.createGraphics(); + big.drawImage(bi, 7, 11, null); + big.dispose(); + // draw to volatile image + BufferedImage snapshot; + while (true) { + vi.validate(gc); + if (vi.validate(gc) != VolatileImage.IMAGE_OK) { + try { + Thread.sleep(100); + } catch (final InterruptedException ignored) { + } + continue; + } + init(vi); + Graphics2D vig = vi.createGraphics(); + vig.drawImage(bi, 7, 11, null); + vig.dispose(); + snapshot = vi.getSnapshot(); + if (vi.contentsLost()) { + try { + Thread.sleep(100); + } catch (final InterruptedException ignored) { + } + continue; + } + break; + } + // validate images + for (int x = 0; x < 1000; ++x) { + for (int y = 0; y < 1000; ++y) { + if (gold.getRGB(x, y) != snapshot.getRGB(x, y)) { + ImageIO.write(gold, "png", new File("gold.png")); + ImageIO.write(snapshot, "png", new File("bi.png")); + throw new RuntimeException("Test failed."); + } + } + } + } + + private static BufferedImage makeManagedBI(final int type) { + final BufferedImage bi; + if (type == TYPE_CUSTOM) { + bi = makeCustomManagedBI(); + } else { + bi = new BufferedImage(511, 255, type); + } + bi.setAccelerationPriority(1.0f); + return bi; + } + + /** + * Returns the custom buffered image, which mostly identical to + * BufferedImage.(w,h,TYPE_3BYTE_BGR), but uses the bigger scanlineStride. + * This means that the raster will have gaps, between the rows. + */ + private static BufferedImage makeCustomManagedBI() { + int w = 511, h = 255; + ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB); + int[] nBits = {8, 8, 8}; + int[] bOffs = {2, 1, 0}; + ColorModel colorModel = new ComponentColorModel(cs, nBits, false, false, + Transparency.OPAQUE, + DataBuffer.TYPE_BYTE); + WritableRaster raster = + Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, w, h, + w * 3 + 2, 3, bOffs, null); + BufferedImage bi = new BufferedImage(colorModel, raster, true, null); + SunWritableRaster.makeTrackable(raster.getDataBuffer()); + SunWritableRaster.markDirty(bi); + return bi; + } + + private static void init(final Image image) { + final Graphics2D graphics = (Graphics2D) image.getGraphics(); + graphics.setComposite(AlphaComposite.Src); + graphics.setColor(new Color(0, 0, 0, 0)); + graphics.fillRect(0, 0, image.getWidth(null), image.getHeight(null)); + graphics.dispose(); + } + + private static void fill(final Image image) { + final Graphics2D graphics = (Graphics2D) image.getGraphics(); + graphics.setComposite(AlphaComposite.Src); + for (int i = 0; i < image.getHeight(null); ++i) { + graphics.setColor(new Color(i, 0, 0)); + graphics.fillRect(0, i, image.getWidth(null), 1); + } + graphics.dispose(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/image/DrawImage/SimpleUnmanagedImage.java Wed Oct 23 15:35:04 2019 +0100 @@ -0,0 +1,201 @@ +/* + * Copyright (c) 2014, 2019, 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. + * + * 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. + */ + +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsEnvironment; +import java.awt.Image; +import java.awt.Transparency; +import java.awt.color.ColorSpace; +import java.awt.image.BufferedImage; +import java.awt.image.ColorModel; +import java.awt.image.ComponentColorModel; +import java.awt.image.DataBuffer; +import java.awt.image.DataBufferByte; +import java.awt.image.DataBufferInt; +import java.awt.image.DataBufferShort; +import java.awt.image.Raster; +import java.awt.image.VolatileImage; +import java.awt.image.WritableRaster; +import java.io.File; +import java.io.IOException; + +import javax.imageio.ImageIO; + +import static java.awt.Transparency.BITMASK; +import static java.awt.Transparency.OPAQUE; +import static java.awt.Transparency.TRANSLUCENT; +import static java.awt.image.BufferedImage.TYPE_3BYTE_BGR; +import static java.awt.image.BufferedImage.TYPE_4BYTE_ABGR; +import static java.awt.image.BufferedImage.TYPE_4BYTE_ABGR_PRE; +import static java.awt.image.BufferedImage.TYPE_BYTE_BINARY; +import static java.awt.image.BufferedImage.TYPE_BYTE_INDEXED; +import static java.awt.image.BufferedImage.TYPE_CUSTOM; +import static java.awt.image.BufferedImage.TYPE_INT_ARGB; +import static java.awt.image.BufferedImage.TYPE_INT_ARGB_PRE; +import static java.awt.image.BufferedImage.TYPE_INT_BGR; +import static java.awt.image.BufferedImage.TYPE_INT_RGB; + +/** + * @test + * @key headful + * @bug 8029253 6207877 + * @summary Tests the case when unmanaged image is drawn to VI. + * Results of the blit to compatibleImage are used for comparison. + * @author Sergey Bylokhov + * @run main/othervm SimpleUnmanagedImage + * @run main/othervm -Dsun.java2d.uiScale=1 SimpleUnmanagedImage + * @run main/othervm -Dsun.java2d.uiScale=2 SimpleUnmanagedImage + */ +public final class SimpleUnmanagedImage { + + // See the same test for managed images: SimpleManagedImage + + private static final int[] TYPES = {TYPE_INT_RGB, TYPE_INT_ARGB, + TYPE_INT_ARGB_PRE, TYPE_INT_BGR, + TYPE_3BYTE_BGR, TYPE_4BYTE_ABGR, + TYPE_4BYTE_ABGR_PRE, + /*TYPE_USHORT_565_RGB, + TYPE_USHORT_555_RGB, TYPE_BYTE_GRAY, + TYPE_USHORT_GRAY,*/ TYPE_BYTE_BINARY, + TYPE_BYTE_INDEXED, TYPE_CUSTOM}; + private static final int[] TRANSPARENCIES = {OPAQUE, BITMASK, TRANSLUCENT}; + + public static void main(final String[] args) throws IOException { + for (final int viType : TRANSPARENCIES) { + for (final int biType : TYPES) { + BufferedImage bi = makeUnmanagedBI(biType); + fill(bi); + test(bi, viType); + } + } + } + + private static void test(BufferedImage bi, int type) + throws IOException { + GraphicsEnvironment ge = GraphicsEnvironment + .getLocalGraphicsEnvironment(); + GraphicsConfiguration gc = ge.getDefaultScreenDevice() + .getDefaultConfiguration(); + VolatileImage vi = gc.createCompatibleVolatileImage(1000, 1000, type); + BufferedImage gold = gc.createCompatibleImage(1000, 1000, type); + // draw to compatible Image + init(gold); + Graphics2D big = gold.createGraphics(); + big.drawImage(bi, 7, 11, null); + big.dispose(); + // draw to volatile image + BufferedImage snapshot; + while (true) { + vi.validate(gc); + if (vi.validate(gc) != VolatileImage.IMAGE_OK) { + try { + Thread.sleep(100); + } catch (final InterruptedException ignored) { + } + continue; + } + init(vi); + Graphics2D vig = vi.createGraphics(); + vig.drawImage(bi, 7, 11, null); + vig.dispose(); + snapshot = vi.getSnapshot(); + if (vi.contentsLost()) { + try { + Thread.sleep(100); + } catch (final InterruptedException ignored) { + } + continue; + } + break; + } + // validate images + for (int x = 0; x < 1000; ++x) { + for (int y = 0; y < 1000; ++y) { + if (gold.getRGB(x, y) != snapshot.getRGB(x, y)) { + ImageIO.write(gold, "png", new File("gold.png")); + ImageIO.write(snapshot, "png", new File("bi.png")); + throw new RuntimeException("Test failed."); + } + } + } + } + + private static BufferedImage makeUnmanagedBI(final int type) { + final BufferedImage bi; + if (type == TYPE_CUSTOM) { + bi = makeCustomUnmanagedBI(); + } else { + bi = new BufferedImage(511, 255, type); + } + final DataBuffer db = bi.getRaster().getDataBuffer(); + if (db instanceof DataBufferInt) { + ((DataBufferInt) db).getData(); + } else if (db instanceof DataBufferShort) { + ((DataBufferShort) db).getData(); + } else if (db instanceof DataBufferByte) { + ((DataBufferByte) db).getData(); + } + bi.setAccelerationPriority(0.0f); + return bi; + } + + /** + * Returns the custom buffered image, which mostly identical to + * BufferedImage.(w,h,TYPE_3BYTE_BGR), but uses the bigger scanlineStride. + * This means that the raster will have gaps, between the rows. + */ + private static BufferedImage makeCustomUnmanagedBI() { + int w = 511, h = 255; + ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB); + int[] nBits = {8, 8, 8}; + int[] bOffs = {2, 1, 0}; + ColorModel colorModel = new ComponentColorModel(cs, nBits, false, false, + Transparency.OPAQUE, + DataBuffer.TYPE_BYTE); + WritableRaster raster = + Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, w, h, + w * 3 + 2, 3, bOffs, null); + return new BufferedImage(colorModel, raster, true, null); + } + + private static void init(final Image image) { + final Graphics2D graphics = (Graphics2D) image.getGraphics(); + graphics.setComposite(AlphaComposite.Src); + graphics.setColor(new Color(0, 0, 0, 0)); + graphics.fillRect(0, 0, image.getWidth(null), image.getHeight(null)); + graphics.dispose(); + } + + private static void fill(final Image image) { + final Graphics2D graphics = (Graphics2D) image.getGraphics(); + graphics.setComposite(AlphaComposite.Src); + for (int i = 0; i < image.getHeight(null); ++i) { + graphics.setColor(new Color(i, 0, 0)); + graphics.fillRect(0, i, image.getWidth(null), 1); + } + graphics.dispose(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/io/FilePermission/Invalid.java Wed Oct 23 15:35:04 2019 +0100 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2016, 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. + * + * 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. + */ + +/** + * + * @test + * @bug 8167646 + * @summary Better invalid FilePermission + * @library /lib/testlibrary + */ + +import jdk.testlibrary.Asserts; + +import java.io.FilePermission; + +public class Invalid { + + public static void main(String args[]) throws Exception { + + // Normal + FilePermission fp = new FilePermission("a", "read"); + + // Invalid + FilePermission fp1 = new FilePermission("a\000", "read"); + FilePermission fp2 = new FilePermission("a\000", "read"); + FilePermission fp3 = new FilePermission("b\000", "read"); + + // Invalid equals to itself + Asserts.assertEQ(fp1, fp1); + + // and not equals to anything else, including other invalid ones + Asserts.assertNE(fp, fp1); + Asserts.assertNE(fp1, fp); + Asserts.assertNE(fp1, fp2); + Asserts.assertNE(fp1, fp3); + + // Invalid implies itself + Asserts.assertTrue(fp1.implies(fp1)); + + // and not implies or implied by anything else, including other + // invalid ones + Asserts.assertFalse(fp.implies(fp1)); + Asserts.assertFalse(fp1.implies(fp)); + Asserts.assertFalse(fp1.implies(fp2)); + Asserts.assertFalse(fp1.implies(fp3)); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/io/LineNumberReader/MarkSplitCRLF.java Wed Oct 23 15:35:04 2019 +0100 @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2019, 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. + * + * 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. + */ + +/* @test + * @bug 8218280 + * @summary Make sure marking a line feed within a CRLF sequence works correctly + * @run testng MarkSplitCRLF + */ + +import java.io.IOException; +import java.io.LineNumberReader; +import java.io.Reader; +import java.io.StringReader; + +import org.testng.annotations.Test; + +import static org.testng.Assert.*; + +public class MarkSplitCRLF { + @Test + public static void testSpecifiedBufferSize() throws IOException { + final String string = "foo\r\nbar"; + try (Reader reader = + new LineNumberReader(new StringReader(string), 5)) { + reader.read(); // 'f' + reader.read(); // 'o' + reader.read(); // 'o' + reader.read(); // '\r' -> '\n' + reader.mark(1); // mark position of '\n' + reader.read(); // 'b' + reader.reset(); // reset to '\n' position + assertEquals(reader.read(), 'b'); + assertEquals(reader.read(), 'a'); + assertEquals(reader.read(), 'r'); + } + } + + @Test + public static void testCRNotFollowedByLF() throws IOException { + final String string = "foo\rbar"; + try (Reader reader = + new LineNumberReader(new StringReader(string), 5)) { + reader.read(); // 'f' + reader.read(); // 'o' + reader.read(); // 'o' + reader.read(); // '\r' + reader.mark(1); // mark position of next character + reader.read(); // 'b' + reader.reset(); // reset to position after '\r' + assertEquals(reader.read(), 'b'); + assertEquals(reader.read(), 'a'); + assertEquals(reader.read(), 'r'); + } + } + + @Test + public static void testDefaultBufferSize() throws IOException { + StringBuilder sb = new StringBuilder(8195); + for (int i = 0; i < 8190; i++) { + char c = (char)i; + sb.append(c); + } + sb.append('\r'); + sb.append('\n'); + sb.append('X'); + sb.append('Y'); + sb.append('Z'); + final String string = sb.toString(); + try (Reader reader = new LineNumberReader(new StringReader(string))) { + for (int i = 0; i < 8191; i++) reader.read(); + reader.mark(1); + reader.read(); + reader.reset(); + assertEquals(reader.read(), 'X'); + assertEquals(reader.read(), 'Y'); + assertEquals(reader.read(), 'Z'); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/nio/channels/AsynchronousSocketChannel/CompletionHandlerRelease.java Wed Oct 23 15:35:04 2019 +0100 @@ -0,0 +1,211 @@ +/* + * 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. + * + * 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. + */ + +/* @test + * @bug 8202252 + * @run testng CompletionHandlerRelease + * @summary Verify that reference to CompletionHandler is cleared after use + */ + +import java.io.Closeable; +import java.io.IOException; +import java.lang.ref.Reference; +import java.lang.ref.ReferenceQueue; +import java.lang.ref.WeakReference; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import static java.net.StandardSocketOptions.*; +import java.nio.ByteBuffer; +import java.nio.channels.AsynchronousChannelGroup; +import java.nio.channels.AsynchronousServerSocketChannel; +import java.nio.channels.AsynchronousSocketChannel; +import java.nio.channels.CompletionHandler; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +import org.testng.annotations.AfterTest; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +public class CompletionHandlerRelease { + @Test + public void testConnect() throws Exception { + try (Server server = new Server()) { + try (AsynchronousSocketChannel ch = + AsynchronousSocketChannel.open(GROUP)) { + CountDownLatch latch = new CountDownLatch(1); + Handler<Void,Object> handler = + new Handler<Void,Object>("connect", latch); + ReferenceQueue queue = new ReferenceQueue<WeakReference>(); + WeakReference<Object> ref = + new WeakReference<Object>(handler, queue); + + ch.connect(server.address(), null, handler); + + try { latch.await(); } catch (InterruptedException ignore) { } + + handler = null; + waitForRefToClear(ref, queue); + + server.accept().get().close(); + } + } + } + + @Test + public void testWrite() throws Exception { + try (Server server = new Server(); + AsynchronousSocketChannel ch = + AsynchronousSocketChannel.open(GROUP)) { + ch.connect(server.address()).get(); + + try (AsynchronousSocketChannel sc = server.accept().get()) { + ByteBuffer src = ByteBuffer.wrap("hello".getBytes("UTF-8")); + sc.setOption(SO_SNDBUF, src.remaining()); + + CountDownLatch latch = new CountDownLatch(1); + Handler<Integer,Object> handler = + new Handler<Integer,Object>("write", latch); + ReferenceQueue queue = new ReferenceQueue<WeakReference>(); + WeakReference<Object> ref = + new WeakReference<Object>(handler, queue); + + sc.write(src, null, handler); + + try { latch.await(); } catch (InterruptedException ignore) { } + + handler = null; + waitForRefToClear(ref, queue); + } + } + } + + @Test + public void testRead() throws Exception { + try (Server server = new Server(); + AsynchronousSocketChannel ch = + AsynchronousSocketChannel.open(GROUP)) { + ch.connect(server.address()).get(); + + try (AsynchronousSocketChannel sc = server.accept().get()) { + ByteBuffer src = ByteBuffer.wrap("hello".getBytes("UTF-8")); + sc.setOption(SO_SNDBUF, src.remaining()); + sc.write(src).get(); + + CountDownLatch latch = new CountDownLatch(1); + Handler<Integer,Object> handler = + new Handler<Integer,Object>("read", latch); + ReferenceQueue queue = new ReferenceQueue<WeakReference>(); + WeakReference<Object> ref = + new WeakReference<Object>(handler, queue); + + ByteBuffer dst = ByteBuffer.allocate(64); + ch.read(dst, null, handler); + + try { latch.await(); } catch (InterruptedException ignore) { } + + handler = null; + waitForRefToClear(ref, queue); + } + } + } + + private AsynchronousChannelGroup GROUP; + + @BeforeTest + void setup() throws IOException { + GROUP = AsynchronousChannelGroup.withFixedThreadPool(2, + Executors.defaultThreadFactory()); + } + + @AfterTest + void cleanup() throws IOException { + GROUP.shutdownNow(); + } + + class Server implements Closeable { + private final AsynchronousServerSocketChannel ssc; + private final InetSocketAddress address; + + Server() throws IOException { + this(0); + } + + Server(int recvBufSize) throws IOException { + ssc = AsynchronousServerSocketChannel.open(GROUP); + if (recvBufSize > 0) { + ssc.setOption(SO_RCVBUF, recvBufSize); + } + ssc.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), + 0)); + address = (InetSocketAddress)ssc.getLocalAddress(); + } + + InetSocketAddress address() { + return address; + } + + Future<AsynchronousSocketChannel> accept() throws IOException { + return ssc.accept(); + } + + public void close() throws IOException { + ssc.close(); + } + } + + static class Handler<V,A> implements CompletionHandler<V,A> { + private final String name; + private final CountDownLatch latch; + + Handler(String name, CountDownLatch latch) { + this.name = name; + this.latch = latch; + } + + public void completed(V result, A attachment) { + System.out.format("%s completed(%s, %s)%n", + name, result, attachment); + latch.countDown(); + } + + public void failed(Throwable exc, A attachment) { + System.out.format("%s failed(%s, %s)%n", + name, exc, attachment); + exc.printStackTrace(); + latch.countDown(); + } + } + + private void waitForRefToClear(Reference ref, ReferenceQueue queue) + throws InterruptedException { + Reference r; + while ((r = queue.remove(20)) == null) { + System.gc(); + } + assertEquals(r, ref); + assertNull(r.get()); + } +}
--- a/test/java/rmi/testlibrary/TestSocketFactory.java Mon Sep 09 17:27:04 2019 +0100 +++ b/test/java/rmi/testlibrary/TestSocketFactory.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, 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 @@ -92,7 +92,8 @@ static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; - public static final boolean DEBUG = false; + // True to enable logging of matches and replacements. + private static volatile boolean debugLogging = false; /** * Debugging output can be synchronized with logging of RMI actions. @@ -100,8 +101,8 @@ * @param format a printf format * @param args any args */ - private static void DEBUG(String format, Object... args) { - if (DEBUG) { + public static void DEBUG(String format, Object... args) { + if (debugLogging) { System.err.printf(format, args); } } @@ -117,6 +118,17 @@ } /** + * Set debug to true to generate logging output of matches and substitutions. + * @param debug {@code true} to generate logging output + * @return the previous value + */ + public static boolean setDebug(boolean debug) { + boolean oldDebug = debugLogging; + debugLogging = debug; + return oldDebug; + } + + /** * Set the match and replacement bytes, with an empty trigger. * The match and replacements are propagated to all existing sockets. *
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/text/Format/NumberFormat/TestPeruCurrencyFormat.java Wed Oct 23 15:35:04 2019 +0100 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2019, 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. + * + * 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. + */ + +/** + * @test + * @bug 8206879 + * @summary Currency decimal marker incorrect for Peru. + * @modules jdk.localedata + * @run main/othervm -Djava.locale.providers=JRE TestPeruCurrencyFormat + */ + +import java.text.NumberFormat; +import java.util.Locale; + +public class TestPeruCurrencyFormat { + + public static void main(String[] args) { + final String expected = "S/.1,234.56"; + NumberFormat currencyFmt = + NumberFormat.getCurrencyInstance(new Locale("es", "PE")); + String s = currencyFmt.format(1234.56); + + if (!s.equals(expected)) { + throw new RuntimeException("Currency format for Peru failed, expected " + expected + ", got " + s); + } + } +}
--- a/test/java/util/Collections/NCopies.java Mon Sep 09 17:27:04 2019 +0100 +++ b/test/java/util/Collections/NCopies.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -82,6 +82,56 @@ checkEmpty(x.subList(x.size()/2, x.size()/2)); } + private static <T> List<T> referenceNCopies(int n, T o) { + // A simplest correct implementation of nCopies to compare with the actual optimized implementation + return new AbstractList<T>() { + public int size() { return n; } + + public T get(int index) { + check(0 <= index && index < n, "Index is incorrect"); + return o; + } + }; + } + + private static void checkHashCode() { + int[] sizes = {0, 1, 2, 3, 5, 10, 31, 32, 100, 1000}; + String[] elements = {null, "non-null"}; + for (int size : sizes) { + for (String element : elements) { + int expectedHashCode = referenceNCopies(size, element).hashCode(); + int actualHashCode = Collections.nCopies(size, element).hashCode(); + check(expectedHashCode == actualHashCode, + "Collections.nCopies(" + size + ", " + element + ").hashCode()"); + } + } + } + + private static void checkEquals() { + int[][] sizePairs = {{0, 0}, {0, 1}, {1, 0}, {1, 1}, {1, 2}, {2, 1}}; + String[] elements = {null, "non-null"}; + for (int[] pair : sizePairs) { + for (String element : elements) { + boolean equal = pair[0] == pair[1]; + String msg = "[" + pair[0] + ", " + element + "] <=> [" + pair[1] + ", " + element + "]"; + check(equal == Collections.nCopies(pair[0], element).equals(Collections.nCopies(pair[1], element)), msg); + check(equal == Collections.nCopies(pair[0], element).equals(referenceNCopies(pair[1], element)), msg); + check(equal == referenceNCopies(pair[0], element).equals(Collections.nCopies(pair[1], element)), msg); + } + } + List<String> nulls = Collections.nCopies(10, null); + List<String> nonNulls = Collections.nCopies(10, "non-null"); + List<String> nullsButOne = new ArrayList<>(nulls); + nullsButOne.set(9, "non-null"); + List<String> nonNullsButOne = new ArrayList<>(nonNulls); + nonNullsButOne.set(9, null); + check(!nulls.equals(nonNulls)); + check(!nulls.equals(nullsButOne)); + check(!nulls.equals(nonNullsButOne)); + check(!nonNulls.equals(nonNullsButOne)); + check(Collections.nCopies(0, null).equals(Collections.nCopies(0, "non-null"))); + } + public static void main(String[] args) { try { List<String> empty = Collections.nCopies(0, "foo"); @@ -92,6 +142,10 @@ check(foos.size() == 42); checkFoos(foos.subList(foos.size()/2, foos.size()-1)); + checkHashCode(); + + checkEquals(); + } catch (Throwable t) { unexpected(t); } System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
--- a/test/java/util/Locale/Bug8040211.java Mon Sep 09 17:27:04 2019 +0100 +++ b/test/java/util/Locale/Bug8040211.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2019, 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 @@ -23,9 +23,9 @@ /* * @test - * @bug 8040211 8191404 8203872 + * @bug 8040211 8191404 8203872 8222980 * @summary Checks the IANA language subtag registry data update - * (LSR Revision: 2018-04-23) with Locale and Locale.LanguageRange + * (LSR Revision: 2019-04-03) with Locale and Locale.LanguageRange * class methods. * @run main Bug8040211 */ @@ -115,7 +115,6 @@ expected.add(new LanguageRange("taj", 0.9)); expected.add(new LanguageRange("tsf", 0.9)); expected.add(new LanguageRange("ar-hyw", 0.8)); - expected.add(new LanguageRange("ar-arevmda", 0.8)); expected.add(new LanguageRange("yug", 0.5)); expected.add(new LanguageRange("yuu", 0.5)); expected.add(new LanguageRange("gfx", 0.4)); @@ -188,7 +187,7 @@ List<Locale> tagList = generateLocales(tags); String actualLocales = showLocales(Locale.filter(priorityList, tagList, mode)); - String expectedLocales = "mtm-RU, ymt-RU, en-GB-oxendict, nts, pij, ar-arevela"; + String expectedLocales = "mtm-RU, ymt-RU, en-GB-oxendict, nts, pij"; if (!expectedLocales.equals(actualLocales)) { error = true;
--- a/test/java/util/Objects/CheckIndex.java Mon Sep 09 17:27:04 2019 +0100 +++ b/test/java/util/Objects/CheckIndex.java Wed Oct 23 15:35:04 2019 +0100 @@ -23,13 +23,12 @@ /** * @test - * @summary Objects.checkIndex/jdk.internal.util.Preconditions.checkIndex tests + * @summary com.sun.crypto.provider.Preconditions.checkIndex tests * @run testng CheckIndex * @bug 8135248 8142493 8155794 - * @modules java.base/jdk.internal.util */ -import jdk.internal.util.Preconditions; +import com.sun.crypto.provider.Preconditions; import org.testng.annotations.DataProvider; import org.testng.annotations.Test;
--- a/test/java/util/TimeZone/TimeZoneTest.java Mon Sep 09 17:27:04 2019 +0100 +++ b/test/java/util/TimeZone/TimeZoneTest.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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 @@ -24,8 +24,7 @@ /* * @test * @bug 4028006 4044013 4096694 4107276 4107570 4112869 4130885 7039469 7126465 7158483 - * 8008577 8077685 8098547 8133321 8138716 8148446 8151876 - * @modules java.base/sun.util.resources + * 8008577 8077685 8098547 8133321 8138716 8148446 8151876 8228469 * @library /java/text/testlib * @summary test TimeZone */ @@ -113,7 +112,7 @@ new ZoneDescriptor("PRT", -240, false), new ZoneDescriptor("CNT", -210, true), new ZoneDescriptor("AGT", -180, false), - new ZoneDescriptor("BET", -180, true), + new ZoneDescriptor("BET", -180, false), // new ZoneDescriptor("CAT", -60, false), // Wrong: // As of bug 4130885, fix CAT (Central Africa) new ZoneDescriptor("CAT", 120, false), // Africa/Harare
--- a/test/java/util/zip/ZipFile/MultiThreadedReadTest.java Mon Sep 09 17:27:04 2019 +0100 +++ b/test/java/util/zip/ZipFile/MultiThreadedReadTest.java Wed Oct 23 15:35:04 2019 +0100 @@ -30,11 +30,13 @@ * @key randomness */ +import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.nio.file.Paths; import java.util.Random; +import java.util.zip.CRC32; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipOutputStream; @@ -43,7 +45,8 @@ public class MultiThreadedReadTest extends Thread { private static final int NUM_THREADS = 10; - private static final String ZIPFILE_NAME = "large.zip"; + private static final String ZIPFILE_NAME = + System.currentTimeMillis() + "-bug8038491-tmp.large.zip"; private static final String ZIPENTRY_NAME = "random.txt"; private static InputStream is = null; @@ -62,23 +65,34 @@ threadArray[i].join(); } } finally { + long t = System.currentTimeMillis(); FileUtils.deleteFileIfExistsWithRetry(Paths.get(ZIPFILE_NAME)); + System.out.println("Deleting zip file took:" + + (System.currentTimeMillis() - t) + "ms"); } } private static void createZipFile() throws Exception { - try (ZipOutputStream zos = - new ZipOutputStream(new FileOutputStream(ZIPFILE_NAME))) { - - zos.putNextEntry(new ZipEntry(ZIPENTRY_NAME)); - StringBuilder sb = new StringBuilder(); - Random rnd = new Random(); - for(int i = 0; i < 1000; i++) { - // append some random string for ZipEntry - sb.append(Long.toString(rnd.nextLong())); + CRC32 crc32 = new CRC32(); + long t = System.currentTimeMillis(); + File zipFile = new File(ZIPFILE_NAME); + try (FileOutputStream fos = new FileOutputStream(zipFile); + BufferedOutputStream bos = new BufferedOutputStream(fos); + ZipOutputStream zos = new ZipOutputStream(bos)) { + ZipEntry e = new ZipEntry(ZIPENTRY_NAME); + e.setMethod(ZipEntry.STORED); + StringBuilder blahBuilder = new StringBuilder(); + for (int i = 0; i < 10_000; i++) { + blahBuilder.append("BLAH"); } - byte[] b = sb.toString().getBytes(); - zos.write(b, 0, b.length); + byte[] toWrite = blahBuilder.toString().getBytes(); + e.setTime(t); + e.setSize(toWrite.length); + crc32.reset(); + crc32.update(toWrite); + e.setCrc(crc32.getValue()); + zos.putNextEntry(e); + zos.write(toWrite); } } @@ -87,6 +101,7 @@ try { while (is.read() != -1) { } } catch (Exception e) { + System.out.println("read exception:" + e); // Swallow any Exceptions (which are expected) - we're only interested in the crash } }
--- a/test/javax/swing/JComboBox/8033069/bug8033069NoScrollBar.java Mon Sep 09 17:27:04 2019 +0100 +++ b/test/javax/swing/JComboBox/8033069/bug8033069NoScrollBar.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2019, 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 @@ -48,7 +48,7 @@ public class bug8033069NoScrollBar implements Runnable { private static final String[] NO_SCROLL_ITEMS = new String[] { - "A", "B", "C", "D", "E", "F" + "AA", "B", "C", "D", "E", "F" }; private final Robot robot; @@ -110,6 +110,7 @@ // Move mouse pointer to the center of the fist combo box Point p = cb1.getLocationOnScreen(); Dimension d = cb1.getSize(); + System.out.println(d.width + "," + d.height); robot.mouseMove(p.x + d.width / 2, p.y + d.height / 2); // Click it to open popup robot.mousePress(InputEvent.BUTTON1_MASK);
--- a/test/javax/swing/JComboBox/8033069/bug8033069ScrollBar.java Mon Sep 09 17:27:04 2019 +0100 +++ b/test/javax/swing/JComboBox/8033069/bug8033069ScrollBar.java Wed Oct 23 15:35:04 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2019, 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 @@ -36,7 +36,7 @@ public class bug8033069ScrollBar extends bug8033069NoScrollBar { private static final String[] SCROLL_ITEMS = new String[] { - "A", "B", "C", "D", "E", "F", + "AA", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R" };
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/SwingUtilities/TestTextPosInPrint.java Wed Oct 23 15:35:04 2019 +0100 @@ -0,0 +1,244 @@ +/* + * Copyright (c) 2019, 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. + * + * 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. + */ + +/* @test + @bug 8214702 + @summary Verifies text position for whitespaced string in printing Swing text + @run main/manual TestTextPosInPrint + */ + +import java.awt.BorderLayout; +import java.awt.FlowLayout; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Font; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.print.Printable; +import java.awt.print.PageFormat; +import java.awt.print.PrinterException; +import java.awt.print.PrinterJob; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import javax.swing.JFrame; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextArea; +import javax.swing.SwingUtilities; +import javax.swing.Timer; +import javax.swing.WindowConstants; +import javax.swing.SwingConstants; +import javax.swing.UIManager; + +public class TestTextPosInPrint implements Printable { + private static final CountDownLatch testEndedSignal = new CountDownLatch(1); + private static final int testTimeout = 300000; + private static volatile String testFailureMsg; + private static volatile boolean testPassed; + private static volatile boolean testFinished; + private static PrinterJob job; + private static JPanel panel; + private static JFrame f; + + public static void main(String[] args) throws Exception { + job = PrinterJob.getPrinterJob(); + if (job.getPrintService() == null) { + System.out.println("This test requires printers to be installed. Exiting."); + return; + } + SwingUtilities.invokeLater(() -> createAndShowTestDialog()); + + try { + if (!testEndedSignal.await(testTimeout, TimeUnit.MILLISECONDS)) { + throw new RuntimeException(String.format( + "Test timeout '%d ms' elapsed.", testTimeout)); + } + if (!testPassed) { + String failureMsg = testFailureMsg; + if ((failureMsg != null) && (!failureMsg.trim().isEmpty())) { + throw new RuntimeException(failureMsg); + } else { + throw new RuntimeException("Test failed."); + } + } + } catch (InterruptedException ie) { + throw new RuntimeException(ie); + } finally { + testFinished = true; + SwingUtilities.invokeAndWait(() -> f.dispose()); + } + } + + private static void doTest() throws Exception { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + f = new JFrame(); + f.setLocationRelativeTo(null); + panel = new JPanel(); + panel.setLayout(new BorderLayout()); + Font font = new Font("Serif", Font.PLAIN, 12); + JLabel l1 = new JLabel(" 1. ABCDE"); + l1.setHorizontalAlignment(SwingConstants.LEFT); + JLabel l2 = new JLabel(" 2. ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"); + l2.setHorizontalAlignment(SwingConstants.LEFT); + //JLabel l3 = new JLabel(" 3. ABCDE "); + JLabel l3 = new JLabel(" 3. ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"); + l3.setHorizontalAlignment(SwingConstants.LEFT); + panel.add(BorderLayout.NORTH, l1); + panel.add(BorderLayout.CENTER, l2); + panel.add(BorderLayout.SOUTH, l3); + f.getContentPane().add(BorderLayout.NORTH, panel); + f.setSize(400, 300); + f.setVisible(true); + + job.setPrintable(new TestTextPosInPrint()); + if (job.printDialog()) { + try { + job.print(); + } catch (PrinterException pe) { + throw new RuntimeException(pe); + } + } + } + + private static void pass() { + testPassed = true; + testEndedSignal.countDown(); + } + + private static void fail(String failureMsg) { + testFailureMsg = failureMsg; + testPassed = false; + testEndedSignal.countDown(); + } + + private static String convertMillisToTimeStr(int millis) { + if (millis < 0) { + return "00:00:00"; + } + int hours = millis / 3600000; + int minutes = (millis - hours * 3600000) / 60000; + int seconds = (millis - hours * 3600000 - minutes * 60000) / 1000; + return String.format("%02d:%02d:%02d", hours, minutes, seconds); + } + + private static void createAndShowTestDialog() { + String description = + " 1. Click on \"Start Test\" button.\r\n" + + " 2. Multiple strings will be displayed on console.\r\n" + + " 3. A print dialog will be shown. Select any printer to print. " + + "\r\n" + + " If the printed output of the strings are same without any alignment issue, click on \"PASS\"\r\n" + + " button, otherwise click on \"FAIL\" button."; + + final JDialog dialog = new JDialog(); + dialog.setTitle("SaveFileWithoutPrinter"); + dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + dialog.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + dialog.dispose(); + fail("Main dialog was closed."); + } + }); + + final JLabel testTimeoutLabel = new JLabel(String.format( + "Test timeout: %s", convertMillisToTimeStr(testTimeout))); + final long startTime = System.currentTimeMillis(); + final Timer timer = new Timer(0, null); + timer.setDelay(1000); + timer.addActionListener((e) -> { + int leftTime = testTimeout - (int) (System.currentTimeMillis() - startTime); + if ((leftTime < 0) || testFinished) { + timer.stop(); + dialog.dispose(); + } + testTimeoutLabel.setText(String.format( + "Test timeout: %s", convertMillisToTimeStr(leftTime))); + }); + timer.start(); + + JTextArea textArea = new JTextArea(description); + textArea.setEditable(false); + + final JButton testButton = new JButton("Start Test"); + final JButton passButton = new JButton("PASS"); + final JButton failButton = new JButton("FAIL"); + testButton.addActionListener((e) -> { + testButton.setEnabled(false); + new Thread(() -> { + try { + doTest(); + + SwingUtilities.invokeLater(() -> { + passButton.setEnabled(true); + failButton.setEnabled(true); + }); + } catch (Throwable t) { + t.printStackTrace(); + dialog.dispose(); + fail("Exception occurred in a thread executing the test."); + } + }).start(); + }); + passButton.setEnabled(false); + passButton.addActionListener((e) -> { + dialog.dispose(); + pass(); + }); + failButton.setEnabled(false); + failButton.addActionListener((e) -> { + dialog.dispose(); + fail("Printed texts are not aligned as shown in console"); + }); + + JPanel mainPanel = new JPanel(new BorderLayout()); + JPanel labelPanel = new JPanel(new FlowLayout()); + labelPanel.add(testTimeoutLabel); + mainPanel.add(labelPanel, BorderLayout.NORTH); + mainPanel.add(textArea, BorderLayout.CENTER); + JPanel buttonPanel = new JPanel(new FlowLayout()); + buttonPanel.add(testButton); + buttonPanel.add(passButton); + buttonPanel.add(failButton); + mainPanel.add(buttonPanel, BorderLayout.SOUTH); + dialog.add(mainPanel); + + dialog.pack(); + dialog.setVisible(true); + } + + @Override + public int print(Graphics pg, PageFormat pf, int pageNum) + throws PrinterException { + if (pageNum > 0){ + return Printable.NO_SUCH_PAGE; + } + + Graphics2D g2 = (Graphics2D) pg; + g2.translate(pf.getImageableX(), pf.getImageableY()); + panel.paint(g2); + return Printable.PAGE_EXISTS; + } +}
--- a/test/jdk/java/awt/print/RemotePrinterStatusRefresh/RemotePrinterStatusRefresh.java Mon Sep 09 17:27:04 2019 +0100 +++ b/test/jdk/java/awt/print/RemotePrinterStatusRefresh/RemotePrinterStatusRefresh.java Wed Oct 23 15:35:04 2019 +0100 @@ -23,10 +23,10 @@ /* * @test - * @bug 8153732 8212202 8221263 8221412 + * @bug 8153732 8212202 8221263 8221412 8222108 * @requires (os.family == "Windows") * @summary Windows remote printer changes do not reflect in lookupPrintServices() - * @run main/manual RemotePrinterStatusRefresh + * @run main/manual/othervm -Dsun.java2d.print.minRefreshTime=120 RemotePrinterStatusRefresh */ import java.awt.BorderLayout; @@ -63,6 +63,9 @@ public class RemotePrinterStatusRefresh extends WindowAdapter { + private static final long DEFAULT_REFRESH_TIME = 240L; + private static final long MINIMAL_REFRESH_TIME = 120L; + private static final long refreshTime = getRefreshTime(); private static final long TIMEOUT = refreshTime * 4 + 60; @@ -181,7 +184,7 @@ + "configured printers.\n" + "Step 1: Add or Remove a network printer using " + "Windows Control Panel.\n" - + "Step 2: Wait for 4 minutes after adding or removing.\n" + + "Step 2: Wait for 2\u20134 minutes after adding or removing.\n" + " \"Next printer refresh in\" gives you a " + "rough estimation on when update will happen.\n" + "Step 3: Click Refresh." @@ -195,7 +198,7 @@ + "Step 5: Click Pass if the list of printers is correctly " + "updated.\n" + "Step 6: If the list is not updated, wait for another " - + "4 minutes, and then click Refresh again.\n" + + "2\u20134 minutes, and then click Refresh again.\n" + "Step 7: If the list does not update, click Fail.\n" + "\n" + "You have to click Refresh to enable Pass and Fail buttons. " @@ -215,12 +218,13 @@ private static long getRefreshTime() { String refreshTime = - System.getProperty("sun.java2d.print.minRefreshTime", "240"); + System.getProperty("sun.java2d.print.minRefreshTime", + Long.toString(DEFAULT_REFRESH_TIME)); try { long value = Long.parseLong(refreshTime); - return value < 240L ? 240L : value; + return value < MINIMAL_REFRESH_TIME ? MINIMAL_REFRESH_TIME : value; } catch (NumberFormatException e) { - return 240L; + return DEFAULT_REFRESH_TIME; } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/lib/testlibrary/jdk/testlibrary/Convert.java Wed Oct 23 15:35:04 2019 +0100 @@ -0,0 +1,84 @@ +/* + * 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. + * + * 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 jdk.testlibrary; + +import java.math.BigInteger; + +/** + * Utility class containing conversions between strings, arrays, and numeric + * values. + */ + +public class Convert { + + // Convert from a byte array to a hexadecimal representation as a string. + public static String byteArrayToHexString(byte[] arr) { + StringBuilder result = new StringBuilder(); + for (int i = 0; i < arr.length; ++i) { + byte curVal = arr[i]; + result.append(Character.forDigit(curVal >> 4 & 0xF, 16)); + result.append(Character.forDigit(curVal & 0xF, 16)); + } + return result.toString(); + } + + // Expand a single byte to a byte array + public static byte[] byteToByteArray(byte v, int length) { + byte[] result = new byte[length]; + result[0] = v; + return result; + } + + // Convert a hexadecimal string to a byte array + public static byte[] hexStringToByteArray(String str) { + byte[] result = new byte[str.length() / 2]; + for (int i = 0; i < result.length; i++) { + result[i] = (byte) Character.digit(str.charAt(2 * i), 16); + result[i] <<= 4; + result[i] += Character.digit(str.charAt(2 * i + 1), 16); + } + return result; + } + + /* + * Convert a hexadecimal string to the corresponding little-ending number + * as a BigInteger. The clearHighBit argument determines whether the most + * significant bit of the highest byte should be set to 0 in the result. + */ + public static + BigInteger hexStringToBigInteger(boolean clearHighBit, String str) { + BigInteger result = BigInteger.ZERO; + for (int i = 0; i < str.length() / 2; i++) { + int curVal = Character.digit(str.charAt(2 * i), 16); + curVal <<= 4; + curVal += Character.digit(str.charAt(2 * i + 1), 16); + if (clearHighBit && i == str.length() / 2 - 1) { + curVal &= 0x7F; + } + result = result.add(BigInteger.valueOf(curVal).shiftLeft(8 * i)); + } + return result; + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/lib/testlibrary/jdk/testlibrary/net/URIBuilder.java Wed Oct 23 15:35:04 2019 +0100 @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, Google 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. + * + * 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 jdk.testlibrary.net; + +import java.net.InetAddress; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; + +public class URIBuilder { + + public static URIBuilder newBuilder() { + return new URIBuilder(); + } + + private String scheme; + private String userInfo; + private String host; + private int port; + private String path; + private String query; + private String fragment; + + private URIBuilder() {} + + public URIBuilder scheme(String scheme) { + this.scheme = scheme; + return this; + } + + public URIBuilder userInfo(String userInfo) { + this.userInfo = userInfo; + return this; + } + + public URIBuilder host(String host) { + this.host = host; + return this; + } + + public URIBuilder loopback() { + return host(InetAddress.getLoopbackAddress().getHostAddress()); + } + + public URIBuilder port(int port) { + this.port = port; + return this; + } + + public URIBuilder path(String path) { + this.path = path; + return this; + } + + public URIBuilder query(String query) { + this.query = query; + return this; + } + + public URIBuilder fragment(String fragment) { + this.fragment = fragment; + return this; + } + + public URI build() throws URISyntaxException { + return new URI(scheme, userInfo, host, port, path, query, fragment); + } + + public URI buildUnchecked() { + try { + return build(); + } catch (URISyntaxException e) { + throw new IllegalArgumentException(e); + } + } + + public URL toURL() throws URISyntaxException, MalformedURLException { + return build().toURL(); + } + + public URL toURLUnchecked() { + try { + return toURL(); + } catch (URISyntaxException | MalformedURLException e) { + throw new IllegalArgumentException(e); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/net/www/protocol/http/TestTransparentNTLM.java Wed Oct 23 15:35:04 2019 +0100 @@ -0,0 +1,203 @@ +/* + * Copyright (c) 2018, 2019, 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. + * + * 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. + */ + +/* + * @test + * @bug 8225425 + * @summary Verifies that transparent NTLM (on Windows) is not used by default, + * and is used only when the relevant property is set. + * @requires os.family == "windows" + * @library ../../../../../lib/testlibrary + * @run testng/othervm + * -Dtest.auth.succeed=false + * TestTransparentNTLM + * @run testng/othervm + * -Djdk.http.ntlm.transparentAuth=allHosts + * -Dtest.auth.succeed=true + * TestTransparentNTLM + * @run testng/othervm + * -Djdk.http.ntlm.transparentAuth=blahblah + * -Dtest.auth.succeed=false + * TestTransparentNTLM + * @run testng/othervm + * -Djdk.http.ntlm.transparentAuth=trustedHosts + * -Dtest.auth.succeed=false + * TestTransparentNTLM + */ + +// Run with `trustedHosts` to exercise the native code, nothing more. + +import java.io.BufferedReader; +import java.io.Closeable; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.URL; +import jdk.testlibrary.net.URIBuilder; +import org.testng.annotations.AfterTest; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; +import org.testng.SkipException; +import static java.lang.System.out; +import static java.net.Proxy.NO_PROXY; +import static java.nio.charset.StandardCharsets.UTF_8; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.fail; + +public class TestTransparentNTLM { + + boolean succeed; // true if authentication is expected to succeed + Server server; + URL url; + + @Test + public void testNTLM() throws IOException { + out.println("connecting to url: " + url); + HttpURLConnection uc = (HttpURLConnection)url.openConnection(NO_PROXY); + int respCode = uc.getResponseCode(); + out.println("received: " + respCode); + + if (succeed) { + assertEquals(respCode, HttpURLConnection.HTTP_OK); + InputStream is = uc.getInputStream(); + BufferedReader r = new BufferedReader(new InputStreamReader(is, UTF_8)); + String body = r.readLine(); + out.print("received body: "); + do { + out.print(body); + body = r.readLine(); + } while (body != null); + } else { + assertEquals(respCode, HttpURLConnection.HTTP_UNAUTHORIZED); + } + } + + static class Server extends Thread implements Closeable { + + static final InetAddress LOOPBACK = InetAddress.getLoopbackAddress(); + final ServerSocket serverSocket; + final boolean expectAuthToSucceed; + + Server(boolean expectAuthToSucceed) throws IOException { + super("TestTransparentNTLM-Server"); + serverSocket = new ServerSocket(); + serverSocket.bind(new InetSocketAddress(LOOPBACK, 0)); + this.expectAuthToSucceed = expectAuthToSucceed; + } + + int port() { + return serverSocket.getLocalPort(); + } + + static final String AUTH_REQUIRED = + "HTTP/1.1 401 Unauthorized\r\n" + + "Content-Length: 0\r\n" + + "Connection: close\r\n" + + "WWW-Authenticate: NTLM\r\n\r\n"; + + static final String AUTH_STAGE_TWO = + "HTTP/1.1 401 Unauthorized\r\n" + + "Content-Length: 0\r\n" + + "WWW-Authenticate: NTLM TlRMTVNTUAACAAAAAAAAACgAAAABggAAU3J2Tm9uY2UAAAAAAAAAAA==\r\n\r\n"; + + static final String AUTH_SUCCESSFUL = + "HTTP/1.1 200 OK\r\n" + + "Content-Length: 11\r\n\r\n" + + "Hello world"; + + @Override + public void run() { + try { + try (Socket s = serverSocket.accept()) { + out.println("Server accepted connection - 1"); + readRequestHeaders(s.getInputStream()); + s.getOutputStream().write(AUTH_REQUIRED.getBytes(UTF_8)); + } + + if (expectAuthToSucceed) { + // await the second follow up connection + try (Socket s = serverSocket.accept()) { + out.println("Server accepted connection - 2"); + readRequestHeaders(s.getInputStream()); + s.getOutputStream().write(AUTH_STAGE_TWO.getBytes(UTF_8)); + readRequestHeaders(s.getInputStream()); + s.getOutputStream().write(AUTH_SUCCESSFUL.getBytes(UTF_8)); + } + } + } catch (IOException e) { + fail("Unexpected exception", e); + } + } + + @Override + public void close() throws IOException { + serverSocket.close(); + } + + static final byte[] REQUEST_END = new byte[] {'\r', '\n', '\r', '\n'}; + + // Read until the end of the HTTP request headers + static void readRequestHeaders(InputStream is) throws IOException { + int requestEndCount = 0, r; + while ((r = is.read()) != -1) { + if (r == REQUEST_END[requestEndCount]) { + requestEndCount++; + if (requestEndCount == 4) { + break; + } + } else { + requestEndCount = 0; + } + } + } + } + + @BeforeTest + public void setup() throws Exception { + succeed = System.getProperty("test.auth.succeed").equals("true"); + if (succeed) + out.println("Expect client to succeed, with 200 Ok"); + else + out.println("Expect client to fail, with 401 Unauthorized"); + + server = new Server(succeed); + server.start(); + url = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(server.port()) + .path("/xxyyzz") + .toURL(); + } + + @AfterTest + public void teardown() throws Exception { + server.close(); + server.join(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/security/ec/SignatureDigestTruncate.java Wed Oct 23 15:35:04 2019 +0100 @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2019, 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. + * + * 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. + */ + +import jdk.testlibrary.Convert; + +import java.security.*; +import java.security.spec.*; +import java.math.*; +import java.util.*; + +/* + * @test + * @bug 8147502 + * @summary Test that digests are properly truncated before the signature + * is applied. The digest should be truncated to the bit length of the + * group order. + * @library /lib/testlibrary + * @build jdk.testlibrary.Convert + * @run main SignatureDigestTruncate + */ +public class SignatureDigestTruncate { + + /* + * A SecureRandom that produces nextBytes in a way that causes the nonce + * to be set to the value supplied to the constructor. This class + * is specific to the way that the native ECDSA implementation in + * SunEC produces nonces from random input. It may not work for all + * test cases, and it will need to be updated when the behavior of + * SunEC changes. + */ + private static class FixedRandom extends SecureRandom { + + private final byte[] val; + + public FixedRandom(byte[] val) { + // SunEC adds one to the value returned, so subtract one here in + // order to get back to the correct value. + BigInteger biVal = new BigInteger(1, val); + biVal = biVal.subtract(BigInteger.ONE); + byte[] temp = biVal.toByteArray(); + this.val = new byte[val.length]; + int inStartPos = Math.max(0, temp.length - val.length); + int outStartPos = Math.max(0, val.length - temp.length); + System.arraycopy(temp, inStartPos, this.val, outStartPos, + temp.length - inStartPos); + } + + @Override + public void nextBytes(byte[] bytes) { + // SunEC samples (n + 1) * 2 bytes, but only n*2 bytes are used by + // the native implementation. So the value must be offset slightly. + Arrays.fill(bytes, (byte) 0); + int copyLength = Math.min(val.length, bytes.length - 2); + System.arraycopy(val, 0, bytes, bytes.length - copyLength - 2, + copyLength); + } + } + + private static void assertEquals(byte[] expected, byte[] actual, + String name) { + if (!Arrays.equals(actual, expected)) { + System.out.println("expect: " + + Convert.byteArrayToHexString(expected)); + System.out.println("actual: " + + Convert.byteArrayToHexString(actual)); + throw new RuntimeException("Incorrect " + name + " value"); + } + } + + private static void runTest(String alg, String curveName, + String privateKeyStr, String msgStr, String kStr, String sigStr) + throws Exception { + + byte[] privateKey = Convert.hexStringToByteArray(privateKeyStr); + byte[] msg = Convert.hexStringToByteArray(msgStr); + byte[] k = Convert.hexStringToByteArray(kStr); + byte[] expectedSig = Convert.hexStringToByteArray(sigStr); + + AlgorithmParameters params = AlgorithmParameters.getInstance("EC"); + params.init(new ECGenParameterSpec(curveName)); + ECParameterSpec ecParams = + params.getParameterSpec(ECParameterSpec.class); + + KeyFactory kf = KeyFactory.getInstance("EC"); + BigInteger s = new BigInteger(1, privateKey); + ECPrivateKeySpec privKeySpec = new ECPrivateKeySpec(s, ecParams); + PrivateKey privKey = kf.generatePrivate(privKeySpec); + + Signature sig = Signature.getInstance(alg); + sig.initSign(privKey, new FixedRandom(k)); + sig.update(msg); + byte[] computedSig = sig.sign(); + assertEquals(expectedSig, computedSig, "signature"); + } + + public static void main(String[] args) throws Exception { + runTest("SHA384withECDSA", "sect283r1", + "abcdef10234567", "010203040506070809", + "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d" + + "1e1f20212223", + "304c022401d7544b5d3935216bd45e2f8042537e1e0296a11e0eb9666619" + + "9281b40942abccd5358a0224035de8a314d3e6c2a97614daebf5fb131354" + + "0eec3f9a3272068aa10922ccae87d255c84c"); + } +}
--- a/test/sun/text/resources/LocaleData Mon Sep 09 17:27:04 2019 +0100 +++ b/test/sun/text/resources/LocaleData Wed Oct 23 15:35:04 2019 +0100 @@ -614,8 +614,6 @@ FormatData/es_PE/DatePatterns/2=dd/MM/yyyy FormatData/es_PE/DatePatterns/3=dd/MM/yy FormatData/es_PE/DateTimePatterns/0={1} {0} -FormatData/es_PE/NumberElements/0=, -FormatData/es_PE/NumberElements/1=. FormatData/es_PE/NumberElements/2=; FormatData/es_PR/NumberPatterns/0=#,##0.###;-#,##0.### # FormatData/es_PR/NumberPatterns/1=$#,##0.00;($#,##0.00) # Changed; see bug 4122840 @@ -8307,3 +8305,8 @@ # bug #8208746 CurrencyNames//ves=Venezuelan Bol\u00edvar Soberano + +# bug# 8206879 +# For Peru decimal separator is changed to dot(.) and grouping separator is changed to comma(,) +FormatData/es_PE/NumberElements/0=. +FormatData/es_PE/NumberElements/1=,