Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/ikvm-fork.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjfrijters <jfrijters>2014-08-06 19:25:11 +0400
committerjfrijters <jfrijters>2014-08-06 19:25:11 +0400
commit6eabab15b884d813755322f57978d10d0c8948cf (patch)
tree36ab6384a3ef80ae44b12ac4d556aafe203ca47d
parent3fd851ee4a0eb998c3948a7dd3149d2a824ecfe2 (diff)
Bug fix. When reading a .class resource from an assembly (to attempt to dynamically define it), read all the bytes.
-rw-r--r--runtime/AssemblyClassLoader.cs10
1 files changed, 9 insertions, 1 deletions
diff --git a/runtime/AssemblyClassLoader.cs b/runtime/AssemblyClassLoader.cs
index 5560ad59..09653c73 100644
--- a/runtime/AssemblyClassLoader.cs
+++ b/runtime/AssemblyClassLoader.cs
@@ -746,7 +746,15 @@ namespace IKVM.Internal
using (java.io.InputStream inp = url.openStream())
{
byte[] buf = new byte[inp.available()];
- inp.read(buf, 0, buf.Length);
+ for (int pos = 0; pos < buf.Length; )
+ {
+ int read = inp.read(buf, pos, buf.Length - pos);
+ if (read <= 0)
+ {
+ break;
+ }
+ pos += read;
+ }
return TypeWrapper.FromClass(Java_java_lang_ClassLoader.defineClass1(GetJavaClassLoader(), name, buf, 0, buf.Length, GetProtectionDomain(), null));
}
}