We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 06aced3 commit 8fac123Copy full SHA for 8fac123
library/src/main/java/com/bumptech/glide/util/ByteBufferUtil.java
@@ -26,9 +26,14 @@ public static ByteBuffer fromFile(File file) throws IOException {
26
RandomAccessFile raf = null;
27
FileChannel channel = null;
28
try {
29
+ long fileLength = file.length();
30
+ // See #2240.
31
+ if (fileLength > Integer.MAX_VALUE) {
32
+ throw new IOException("File too large to map into memory");
33
+ }
34
raf = new RandomAccessFile(file, "r");
35
channel = raf.getChannel();
- return channel.map(FileChannel.MapMode.READ_ONLY, 0, file.length()).load();
36
+ return channel.map(FileChannel.MapMode.READ_ONLY, 0, fileLength).load();
37
} finally {
38
if (channel != null) {
39
0 commit comments