Skip to content

Commit

Permalink
Load until complete. Code never considered file size.
Browse files Browse the repository at this point in the history
  • Loading branch information
wasabii committed Dec 11, 2024
1 parent 00a32da commit cbbce3f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1238,9 +1238,18 @@ public Void run() {
int len = uconn.getContentLength();
byte[] bytes = new byte[len];
try (java.io.InputStream str = uconn.getInputStream()) {
int nr = str.read(bytes);
if (nr != len) throw new java.io.IOException(tResource);
int rem = len;
while (rem > 0) {
final int nrd = str.read(bytes, bytes.length - rem, rem);
if (nrd == -1) break;
rem -= nrd;
}

if (rem != 0) {
throw new java.io.IOException(tResource);
}
}

values[0] = bytes;
} catch (java.io.IOException ex) {
throw new InternalError(ex);
Expand Down

0 comments on commit cbbce3f

Please sign in to comment.