From 19a27ed5a1c0a6d7a3a63e8dcdf2d8ae0a37a69c Mon Sep 17 00:00:00 2001 From: haru-s Date: Tue, 18 Jun 2024 22:57:07 +0900 Subject: [PATCH] Fix Picture.fromFile for x86. --- source/dfl/drawing.d | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/dfl/drawing.d b/source/dfl/drawing.d index e5a14cb..51b0432 100644 --- a/source/dfl/drawing.d +++ b/source/dfl/drawing.d @@ -1533,8 +1533,10 @@ class Picture: Image // docmain /// ditto static Picture fromFile(File file) { - auto size = file.size(); - ubyte[] buf = file.rawRead(new ubyte[size]); + ulong size = file.size(); + if (size > size_t.max) + throw new DflException("DFL: Picture.fromFile failure by large file given."); + ubyte[] buf = file.rawRead(new ubyte[cast(size_t)size]); return fromMemory(buf); }