Skip to content

Commit c078969

Browse files
committed
read the whole file in zipimporter, not only the first buffer size bytes
1 parent c7675c3 commit c078969

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/zipimporter/ZipImporterBuiltins.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,10 @@ public PBytes doit(PZipImporter self, String pathname) {
333333
throw raise(PythonErrorType.ZipImportError, "zipimport: cannot read archive members large than 2GB");
334334
}
335335
byte[] bytes = new byte[byteSize];
336-
in.read(bytes);
336+
int bytesRead = 0;
337+
while (bytesRead < byteSize) {
338+
bytesRead += in.read(bytes, bytesRead, byteSize - bytesRead);
339+
}
337340
in.close();
338341
return factory().createBytes(bytes);
339342
} catch (IOException e) {

0 commit comments

Comments
 (0)