jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java | 32 +++++++++++++---- jurt/com/sun/star/lib/uno/protocols/urp/urp.java | 10 ++++- 2 files changed, 33 insertions(+), 9 deletions(-)
New commits: commit 1629228b7b7c77dcbdedbd5acb403e6ea0492247 Author: Stephan Bergmann <[email protected]> Date: Wed Feb 24 11:20:39 2016 +0100 cid#1326391: Dereference null return value ...replacing implicit NullPointerException with explicit IOException Change-Id: I673c836c64e141a7a3e4b40fca0922feee26bd03 diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/urp.java b/jurt/com/sun/star/lib/uno/protocols/urp/urp.java index 5e7b328..3033481 100644 --- a/jurt/com/sun/star/lib/uno/protocols/urp/urp.java +++ b/jurt/com/sun/star/lib/uno/protocols/urp/urp.java @@ -398,14 +398,16 @@ public final class urp implements IProtocol { return readRequest(funId, sync); } - private UrpMessage readShortRequest(int header) { + private UrpMessage readShortRequest(int header) throws IOException { int funId = (header & HEADER_FUNCTIONID14) != 0 ? ((header & HEADER_FUNCTIONID) << 8) | unmarshal.read8Bit() : header & HEADER_FUNCTIONID; return readRequest(funId, false); } - private UrpMessage readRequest(int functionId, boolean forcedSynchronous) { + private UrpMessage readRequest(int functionId, boolean forcedSynchronous) + throws IOException + { boolean internal = PROPERTIES_OID.equals(inL1Oid); // inL1Oid may be null in XInstanceProvider.getInstance("") XCurrentContext cc = @@ -415,6 +417,10 @@ public final class urp implements IProtocol { new Type(XCurrentContext.class)) : null; IMethodDescription desc = inL1Type.getMethodDescription(functionId); + if (desc == null) { + throw new IOException( + "read URP request with unsupported function ID " + functionId); + } ITypeDescription[] inSig = desc.getInSignature(); ITypeDescription[] outSig = desc.getOutSignature(); Object[] args = new Object[inSig.length]; commit d79ce8ba8f9e2411ab70b5c9d2ea0bb6b4f4e84e Author: Stephan Bergmann <[email protected]> Date: Wed Feb 24 10:46:36 2016 +0100 cid#1326441,1326442,1326392: Dereference null return value ...replacing implicit NullPointerException/IndexOutOfBoundsException with explicit RuntimeException Change-Id: I519b0fcd2b2d2657ae82ef7eb28f88a0e13fa970 diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java b/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java index a2681b0..c8d14e9 100644 --- a/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java +++ b/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java @@ -124,8 +124,18 @@ final class Unmarshal { return TypeDescription.getTypeDescription(typeClass); } else { int index = read16Bit(); - TypeDescription type = null; - if ((b & 0x80) != 0) { + TypeDescription type; + if ((b & 0x80) == 0) { + if (index >= typeCache.length) { + throw new RuntimeException( + "Reading TYPE with bad cache index " + index); + } + type = typeCache[index]; + if (type == null) { + throw new RuntimeException( + "Reading TYPE with empty cache index " + index); + } + } else { try { type = TypeDescription.getTypeDescription( readStringValue()); @@ -134,11 +144,11 @@ final class Unmarshal { } catch (ClassNotFoundException e) { throw new RuntimeException(e); } - } - if (index != 0xFFFF) { - if ((b & 0x80) == 0) { - type = typeCache[index]; - } else { + if (index != 0xFFFF) { + if (index >= typeCache.length) { + throw new RuntimeException( + "Reading TYPE with bad cache index " + index); + } typeCache[index] = type; } } commit 3e945cbd9b23a98d22065f1593295a7afa410c9e Author: Stephan Bergmann <[email protected]> Date: Tue Feb 23 17:51:13 2016 +0100 Be specific about illegal input Change-Id: Ib840f5516e503ce92078150933217149fd322bde diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java b/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java index 93a56b4..a2681b0 100644 --- a/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java +++ b/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java @@ -117,6 +117,10 @@ final class Unmarshal { "Reading TYPE with bad type class " + (b & 0x7F)); } if (TypeDescription.isTypeClassSimple(typeClass)) { + if ((b & 0x80) != 0) { + throw new RuntimeException( + "Reading TYPE with bad type class/cache flag " + b); + } return TypeDescription.getTypeDescription(typeClass); } else { int index = read16Bit(); commit 74a18f64eebc8f6f66d64e439e152c6cdf9d76db Author: Stephan Bergmann <[email protected]> Date: Tue Feb 23 17:28:43 2016 +0100 cid#1326440 Dereference null return value ...replacing implicit NullPointerException with explicit RuntimeException Change-Id: I14dfe81a6a05d33cb311a6274c085ea0dcf95692 diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java b/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java index 48d7630..93a56b4 100644 --- a/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java +++ b/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java @@ -112,6 +112,10 @@ final class Unmarshal { public TypeDescription readType() { int b = read8Bit(); TypeClass typeClass = TypeClass.fromInt(b & 0x7F); + if (typeClass == null) { + throw new RuntimeException( + "Reading TYPE with bad type class " + (b & 0x7F)); + } if (TypeDescription.isTypeClassSimple(typeClass)) { return TypeDescription.getTypeDescription(typeClass); } else { _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
