changeset in /hg/icedtea: Fix security patches for JDK7.
Andrew John Hughes
gnu_andrew at member.fsf.org
Thu Dec 4 06:11:26 PST 2008
changeset 744a654041ac in /hg/icedtea
details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=744a654041ac
description:
Fix security patches for JDK7.
2008-12-02 Andrew John Hughes <ahughes at redhat.com>
* patches/icedtea-4486841.patch,
* patches/icedtea-6728542-epoll.patch:
Removed, already applied to JDK7.
* Makefile.am: Remove unneeded patches.
* javac.in: Fix use of 'else if' for 'elsif'.
* patches/icedtea-6484091.patch,
* patches/icedtea-6497740.patch,
* patches/icedtea-6592792.patch,
* patches/icedtea-6733959.patch,
* patches/icedtea-6755943.patch,
* patches/icedtea-ecj-pr261.patch:
Ported to JDK7.
diffstat:
11 files changed, 1126 insertions(+), 2784 deletions(-)
ChangeLog | 15
Makefile.am | 2
javac.in | 2
patches/icedtea-4486841.patch | 1234 -------------------------
patches/icedtea-6484091.patch | 78 -
patches/icedtea-6497740.patch | 1694 +++++++++++++++++------------------
patches/icedtea-6592792.patch | 235 +---
patches/icedtea-6728542-epoll.patch | 90 -
patches/icedtea-6733959.patch | 260 ++---
patches/icedtea-6755943.patch | 250 -----
patches/icedtea-ecj-pr261.patch | 50 -
diffs (truncated from 4256 to 500 lines):
diff -r 6b24535880de -r 744a654041ac ChangeLog
--- a/ChangeLog Tue Dec 02 13:58:24 2008 +0000
+++ b/ChangeLog Wed Dec 03 14:36:23 2008 +0000
@@ -1,3 +1,18 @@ 2008-12-02 Andrew John Hughes <ahughes
+2008-12-02 Andrew John Hughes <ahughes at redhat.com>
+
+ * patches/icedtea-4486841.patch,
+ * patches/icedtea-6728542-epoll.patch:
+ Removed, already applied to JDK7.
+ * Makefile.am: Remove unneeded patches.
+ * javac.in: Fix use of 'else if' for 'elsif'.
+ * patches/icedtea-6484091.patch,
+ * patches/icedtea-6497740.patch,
+ * patches/icedtea-6592792.patch,
+ * patches/icedtea-6733959.patch,
+ * patches/icedtea-6755943.patch,
+ * patches/icedtea-ecj-pr261.patch:
+ Ported to JDK7.
+
2008-12-02 Andrew John Hughes <ahughes at redhat.com>
Merge from IcedTea6.
diff -r 6b24535880de -r 744a654041ac Makefile.am
--- a/Makefile.am Tue Dec 02 13:58:24 2008 +0000
+++ b/Makefile.am Wed Dec 03 14:36:23 2008 +0000
@@ -1852,8 +1852,6 @@ ICEDTEA_PATCHES = \
patches/icedtea-testenv.patch \
$(ZERO_PATCHES_COND) \
patches/icedtea-samejvm-safe.patch \
- patches/icedtea-6728542-epoll.patch \
- patches/icedtea-4486841.patch \
patches/icedtea-6484091.patch \
patches/icedtea-6497740.patch \
patches/icedtea-6588160.patch \
diff -r 6b24535880de -r 744a654041ac javac.in
--- a/javac.in Tue Dec 02 13:58:24 2008 +0000
+++ b/javac.in Wed Dec 03 14:36:23 2008 +0000
@@ -35,7 +35,7 @@ if ( -e "@abs_top_builddir@/native-ecj"
{
exec '@abs_top_builddir@/native-ecj', '-1.5', '-nowarn', @bcoption, @new_args ;
}
-else if ( -e "@ECJ@" )
+elsif ( -e "@ECJ@" )
{
exec '@ECJ@', '-1.5', '-nowarn', @bcoption, @new_args ;
}
diff -r 6b24535880de -r 744a654041ac patches/icedtea-4486841.patch
--- a/patches/icedtea-4486841.patch Tue Dec 02 13:58:24 2008 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1234 +0,0 @@
---- old/src/share/classes/sun/nio/cs/UTF_8.java Thu Oct 9 16:02:01 2008
-+++ openjdk/jdk/src/share/classes/sun/nio/cs/UTF_8.java Thu Oct 9 16:02:01 2008
-@@ -1,5 +1,5 @@
- /*
-- * Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved.
-+ * Copyright 2000-2008 Sun Microsystems, Inc. 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,34 +25,36 @@
-
- package sun.nio.cs;
-
-+import java.nio.Buffer;
- import java.nio.ByteBuffer;
- import java.nio.CharBuffer;
--import java.nio.BufferOverflowException;
--import java.nio.BufferUnderflowException;
- import java.nio.charset.Charset;
- import java.nio.charset.CharsetDecoder;
- import java.nio.charset.CharsetEncoder;
- import java.nio.charset.CoderResult;
--import java.nio.charset.CharacterCodingException;
--import java.nio.charset.MalformedInputException;
--import java.nio.charset.UnmappableCharacterException;
-
--
--/*
-- * # Bits Bit pattern
-- * 1 7 0xxxxxxx
-- * 2 11 110xxxxx 10xxxxxx
-- * 3 16 1110xxxx 10xxxxxx 10xxxxxx
-- * 4 21 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
-- * 5 26 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
-- * 6 31 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
-+/* Legal UTF-8 Byte Sequences
- *
-- * UCS-2 uses 1-3, UTF-16 uses 1-4, UCS-4 uses 1-6
-+ * # Code Points Bits Bit/Byte pattern
-+ * 1 7 0xxxxxxx
-+ * U+0000..U+007F 00..7F
-+ *
-+ * 2 11 110xxxxx 10xxxxxx
-+ * U+0080..U+07FF C2..DF 80..BF
-+ *
-+ * 3 16 1110xxxx 10xxxxxx 10xxxxxx
-+ * U+0800..U+0FFF E0 A0..BF 80..BF
-+ * U+1000..U+FFFF E1..EF 80..BF 80..BF
-+ *
-+ * 4 21 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
-+ * U+10000..U+3FFFF F0 90..BF 80..BF 80..BF
-+ * U+40000..U+FFFFF F1..F3 80..BF 80..BF 80..BF
-+ * U+100000..U10FFFF F4 80..8F 80..BF 80..BF
-+ *
- */
-
- class UTF_8 extends Unicode
- {
--
- public UTF_8() {
- super("UTF-8", StandardCharsets.aliases_UTF_8);
- }
-@@ -69,6 +71,11 @@
- return new Encoder(this);
- }
-
-+ static final void updatePositions(Buffer src, int sp,
-+ Buffer dst, int dp) {
-+ src.position(sp - src.arrayOffset());
-+ dst.position(dp - dst.arrayOffset());
-+ }
-
- private static class Decoder extends CharsetDecoder {
- private Decoder(Charset cs) {
-@@ -75,161 +82,182 @@
- super(cs, 1.0f, 1.0f);
- }
-
-- private boolean isContinuation(int b) {
-- return ((b & 0xc0) == 0x80);
-+ private static boolean isNotContinuation(int b) {
-+ return (b & 0xc0) != 0x80;
- }
-
-- private final Surrogate.Generator sgg = new Surrogate.Generator();
-+ // [C2..DF] [80..BF]
-+ private static boolean isMalformed2(int b1, int b2) {
-+ return (b1 & 0x1e) == 0x0 || (b2 & 0xc0) != 0x80;
-+ }
-
-+ // [E0] [A0..BF] [80..BF]
-+ // [E1..EF] [80..BF] [80..BF]
-+ private static boolean isMalformed3(int b1, int b2, int b3) {
-+ return (b1 == (byte)0xe0 && (b2 & 0xe0) == 0x80) ||
-+ (b2 & 0xc0) != 0x80 || (b3 & 0xc0) != 0x80;
-+ }
-+
-+ // [F0] [90..BF] [80..BF] [80..BF]
-+ // [F1..F3] [80..BF] [80..BF] [80..BF]
-+ // [F4] [80..8F] [80..BF] [80..BF]
-+ // only check 80-be range here, the [0xf0,0x80...] and [0xf4,0x90-...]
-+ // will be checked by Surrogate.neededFor(uc)
-+ private static boolean isMalformed4(int b2, int b3, int b4) {
-+ return (b2 & 0xc0) != 0x80 || (b3 & 0xc0) != 0x80 ||
-+ (b4 & 0xc0) != 0x80;
-+ }
-+
-+ private static CoderResult lookupN(ByteBuffer src, int n)
-+ {
-+ for (int i = 1; i < n; i++) {
-+ if (isNotContinuation(src.get()))
-+ return CoderResult.malformedForLength(i);
-+ }
-+ return CoderResult.malformedForLength(n);
-+ }
-+
-+ private static CoderResult malformedN(ByteBuffer src, int nb) {
-+ switch (nb) {
-+ case 1:
-+ int b1 = src.get();
-+ if ((b1 >> 2) == -2) {
-+ // 5 bytes 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
-+ if (src.remaining() < 4)
-+ return CoderResult.UNDERFLOW;
-+ return lookupN(src, 5);
-+ }
-+ if ((b1 >> 1) == -2) {
-+ // 6 bytes 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
-+ if (src.remaining() < 5)
-+ return CoderResult.UNDERFLOW;
-+ return lookupN(src, 6);
-+ }
-+ return CoderResult.malformedForLength(1);
-+ case 2: // always 1
-+ return CoderResult.malformedForLength(1);
-+ case 3:
-+ b1 = src.get();
-+ int b2 = src.get(); // no need to lookup b3
-+ return CoderResult.malformedForLength(
-+ ((b1 == (byte)0xe0 && (b2 & 0xe0) == 0x80) ||
-+ isNotContinuation(b2))?1:2);
-+ case 4: // we don't care the speed here
-+ b1 = src.get() & 0xff;
-+ b2 = src.get() & 0xff;
-+ if (b1 > 0xf4 ||
-+ (b1 == 0xf0 && (b2 < 0x90 || b2 > 0xbf)) ||
-+ (b1 == 0xf4 && (b2 & 0xf0) != 0x80) ||
-+ isNotContinuation(b2))
-+ return CoderResult.malformedForLength(1);
-+ if (isNotContinuation(src.get()))
-+ return CoderResult.malformedForLength(2);
-+ return CoderResult.malformedForLength(3);
-+ default:
-+ assert false;
-+ return null;
-+ }
-+ }
-+
-+ private static CoderResult malformed(ByteBuffer src, int sp,
-+ CharBuffer dst, int dp,
-+ int nb)
-+ {
-+ src.position(sp - src.arrayOffset());
-+ CoderResult cr = malformedN(src, nb);
-+ updatePositions(src, sp, dst, dp);
-+ return cr;
-+ }
-+
-+ private static CoderResult malformed(ByteBuffer src,
-+ int mark, int nb)
-+ {
-+ src.position(mark);
-+ CoderResult cr = malformedN(src, nb);
-+ src.position(mark);
-+ return cr;
-+ }
-+
-+ private static CoderResult xflow(Buffer src, int sp, int sl,
-+ Buffer dst, int dp, int nb) {
-+ updatePositions(src, sp, dst, dp);
-+ return (nb == 0 || sl - sp < nb)
-+ ?CoderResult.UNDERFLOW:CoderResult.OVERFLOW;
-+ }
-+
-+ private static CoderResult xflow(Buffer src, int mark, int nb) {
-+ CoderResult cr = (nb == 0 || src.remaining() < (nb - 1))
-+ ?CoderResult.UNDERFLOW:CoderResult.OVERFLOW;
-+ src.position(mark);
-+ return cr;
-+ }
-+
- private CoderResult decodeArrayLoop(ByteBuffer src,
- CharBuffer dst)
- {
-+ // This method is optimized for ASCII input.
- byte[] sa = src.array();
- int sp = src.arrayOffset() + src.position();
- int sl = src.arrayOffset() + src.limit();
-- assert (sp <= sl);
-- sp = (sp <= sl ? sp : sl);
-+
- char[] da = dst.array();
- int dp = dst.arrayOffset() + dst.position();
- int dl = dst.arrayOffset() + dst.limit();
-- assert (dp <= dl);
-- dp = (dp <= dl ? dp : dl);
-+ int dlASCII = dp + Math.min(sl - sp, dl - dp);
-
-- try {
-- while (sp < sl) {
-- int b1 = sa[sp];
-- int b2, b3;
-- switch ((b1 >> 4) & 0x0f) {
-+ // ASCII only loop
-+ while (dp < dlASCII && sa[sp] >= 0)
-+ da[dp++] = (char)sa[sp++];
-
-- case 0: case 1: case 2: case 3:
-- case 4: case 5: case 6: case 7:
-- // 1 byte, 7 bits: 0xxxxxxx
-- if (dl - dp < 1)
-- return CoderResult.OVERFLOW;
-- da[dp++] = (char)(b1 & 0x7f);
-- sp++;
-- continue;
--
-- case 12: case 13:
-- // 2 bytes, 11 bits: 110xxxxx 10xxxxxx
-- if (sl - sp < 2)
-- return CoderResult.UNDERFLOW;
-- if (dl - dp < 1)
-- return CoderResult.OVERFLOW;
-- if (!isContinuation(b2 = sa[sp + 1]))
-- return CoderResult.malformedForLength(1);
-- da[dp++] = ((char)(((b1 & 0x1f) << 6) |
-- ((b2 & 0x3f) << 0)));
-- sp += 2;
-- continue;
--
-- case 14:
-- // 3 bytes, 16 bits: 1110xxxx 10xxxxxx 10xxxxxx
-- if (sl - sp < 3)
-- return CoderResult.UNDERFLOW;
-- if (dl - dp < 1)
-- return CoderResult.OVERFLOW;
-- if (!isContinuation(b2 = sa[sp + 1]))
-- return CoderResult.malformedForLength(1);
-- if (!isContinuation(b3 = sa[sp + 2]))
-- return CoderResult.malformedForLength(2);
-- da[dp++] = ((char)(((b1 & 0x0f) << 12) |
-- ((b2 & 0x3f) << 06) |
-- ((b3 & 0x3f) << 0)));
-- sp += 3;
-- continue;
--
-- case 15:
-- // 4, 5, or 6 bytes
--
-- int b4, b5, b6, uc, n;
-- switch (b1 & 0x0f) {
--
-- case 0: case 1: case 2: case 3:
-- case 4: case 5: case 6: case 7:
-- // 4 bytes, 21 bits
-- if (sl - sp < 4)
-- return CoderResult.UNDERFLOW;
-- if (!isContinuation(b2 = sa[sp + 1]))
-- return CoderResult.malformedForLength(1);
-- if (!isContinuation(b3 = sa[sp + 2]))
-- return CoderResult.malformedForLength(2);
-- if (!isContinuation(b4 = sa[sp + 3]))
-- return CoderResult.malformedForLength(3);
-- uc = (((b1 & 0x07) << 18) |
-- ((b2 & 0x3f) << 12) |
-- ((b3 & 0x3f) << 06) |
-- ((b4 & 0x3f) << 00));
-- n = 4;
-- break;
--
-- case 8: case 9: case 10: case 11:
-- // 5 bytes, 26 bits
-- if (sl - sp < 5)
-- return CoderResult.UNDERFLOW;
-- if (!isContinuation(b2 = sa[sp + 1]))
-- return CoderResult.malformedForLength(1);
-- if (!isContinuation(b3 = sa[sp + 2]))
-- return CoderResult.malformedForLength(2);
-- if (!isContinuation(b4 = sa[sp + 3]))
-- return CoderResult.malformedForLength(3);
-- if (!isContinuation(b5 = sa[sp + 4]))
-- return CoderResult.malformedForLength(4);
-- uc = (((b1 & 0x03) << 24) |
-- ((b2 & 0x3f) << 18) |
-- ((b3 & 0x3f) << 12) |
-- ((b4 & 0x3f) << 06) |
-- ((b5 & 0x3f) << 00));
-- n = 5;
-- break;
--
-- case 12: case 13:
-- // 6 bytes, 31 bits
-- if (sl - sp < 6)
-- return CoderResult.UNDERFLOW;
-- if (!isContinuation(b2 = sa[sp + 1]))
-- return CoderResult.malformedForLength(1);
-- if (!isContinuation(b3 = sa[sp + 2]))
-- return CoderResult.malformedForLength(2);
-- if (!isContinuation(b4 = sa[sp + 3]))
-- return CoderResult.malformedForLength(3);
-- if (!isContinuation(b5 = sa[sp + 4]))
-- return CoderResult.malformedForLength(4);
-- if (!isContinuation(b6 = sa[sp + 5]))
-- return CoderResult.malformedForLength(5);
-- uc = (((b1 & 0x01) << 30) |
-- ((b2 & 0x3f) << 24) |
-- ((b3 & 0x3f) << 18) |
-- ((b4 & 0x3f) << 12) |
-- ((b5 & 0x3f) << 06) |
-- ((b6 & 0x3f)));
-- n = 6;
-- break;
--
-- default:
-- return CoderResult.malformedForLength(1);
--
-- }
--
-- int gn = sgg.generate(uc, n, da, dp, dl);
-- if (gn < 0)
-- return sgg.error();
-- dp += gn;
-- sp += n;
-- continue;
--
-- default:
-- return CoderResult.malformedForLength(1);
--
-+ while (sp < sl) {
-+ int b1 = sa[sp];
-+ if (b1 >= 0) {
-+ // 1 byte, 7 bits: 0xxxxxxx
-+ if (dp >= dl)
-+ return xflow(src, sp, sl, dst, dp, 1);
-+ da[dp++] = (char)b1;
-+ sp++;
-+ } else if ((b1 >> 5) == -2) {
-+ // 2 bytes, 11 bits: 110xxxxx 10xxxxxx
-+ if (sl - sp < 2 || dp >= dl)
-+ return xflow(src, sp, sl, dst, dp, 2);
-+ int b2 = sa[sp + 1];
-+ if (isMalformed2(b1, b2))
-+ return malformed(src, sp, dst, dp, 2);
-+ da[dp++] = (char) (((b1 << 6) ^ b2) ^ 0x0f80);
-+ sp += 2;
-+ } else if ((b1 >> 4) == -2) {
-+ // 3 bytes, 16 bits: 1110xxxx 10xxxxxx 10xxxxxx
-+ if (sl - sp < 3 || dp >= dl)
-+ return xflow(src, sp, sl, dst, dp, 3);
-+ int b2 = sa[sp + 1];
-+ int b3 = sa[sp + 2];
-+ if (isMalformed3(b1, b2, b3))
-+ return malformed(src, sp, dst, dp, 3);
-+ da[dp++] = (char) (((b1 << 12) ^ (b2 << 6) ^ b3) ^ 0x1f80);
-+ sp += 3;
-+ } else if ((b1 >> 3) == -2) {
-+ // 4 bytes, 21 bits: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
-+ if (sl - sp < 4 || dl - dp < 2)
-+ return xflow(src, sp, sl, dst, dp, 4);
-+ int b2 = sa[sp + 1];
-+ int b3 = sa[sp + 2];
-+ int b4 = sa[sp + 3];
-+ int uc = ((b1 & 0x07) << 18) |
-+ ((b2 & 0x3f) << 12) |
-+ ((b3 & 0x3f) << 06) |
-+ (b4 & 0x3f);
-+ if (isMalformed4(b2, b3, b4) ||
-+ !Surrogate.neededFor(uc)) {
-+ return malformed(src, sp, dst, dp, 4);
- }
--
-- }
--
-- return CoderResult.UNDERFLOW;
-- } finally {
-- src.position(sp - src.arrayOffset());
-- dst.position(dp - dst.arrayOffset());
-+ da[dp++] = Surrogate.high(uc);
-+ da[dp++] = Surrogate.low(uc);
-+ sp += 4;
-+ } else
-+ return malformed(src, sp, dst, dp, 1);
- }
-+ return xflow(src, sp, sl, dst, dp, 0);
- }
-
- private CoderResult decodeBufferLoop(ByteBuffer src,
-@@ -236,137 +264,57 @@
- CharBuffer dst)
- {
- int mark = src.position();
-- try {
-- while (src.hasRemaining()) {
-- int b1 = src.get();
-- int b2, b3;
-- switch ((b1 >> 4) & 0x0f) {
--
-- case 0: case 1: case 2: case 3:
-- case 4: case 5: case 6: case 7:
-- // 1 byte, 7 bits: 0xxxxxxx
-- if (dst.remaining() < 1)
-- return CoderResult.OVERFLOW;
-- dst.put((char)b1);
-- mark++;
-- continue;
--
-- case 12: case 13:
-- // 2 bytes, 11 bits: 110xxxxx 10xxxxxx
-- if (src.remaining() < 1)
-- return CoderResult.UNDERFLOW;
-- if (dst.remaining() < 1)
-- return CoderResult.OVERFLOW;
-- if (!isContinuation(b2 = src.get()))
-- return CoderResult.malformedForLength(1);
-- dst.put((char)(((b1 & 0x1f) << 6) |
-- ((b2 & 0x3f) << 0)));
-- mark += 2;
-- continue;
--
-- case 14:
-- // 3 bytes, 16 bits: 1110xxxx 10xxxxxx 10xxxxxx
-- if (src.remaining() < 2)
-- return CoderResult.UNDERFLOW;
-- if (dst.remaining() < 1)
-- return CoderResult.OVERFLOW;
-- if (!isContinuation(b2 = src.get()))
-- return CoderResult.malformedForLength(1);
-- if (!isContinuation(b3 = src.get()))
-- return CoderResult.malformedForLength(2);
-- dst.put((char)(((b1 & 0x0f) << 12) |
-- ((b2 & 0x3f) << 06) |
-- ((b3 & 0x3f) << 0)));
-- mark += 3;
-- continue;
--
-- case 15:
-- // 4, 5, or 6 bytes
--
-- int b4, b5, b6, uc, n;
-- switch (b1 & 0x0f) {
--
More information about the distro-pkg-dev
mailing list