GNOME Bugzilla – Bug 398311
GIMP swap file overflow
Last modified: 2008-01-15 13:23:45 UTC
Steps to reproduce: 1. Load a large image, so that the GIMP swap file grows very large 2. Wait until image loads 3. Watch the GIMP crash (message window with some error flashes on the taskbar and all you can do is to close the GIMP) Stack trace: Other information: "A large image" in my case was a 19000px x 28000px PNG file (size on disk is about 3MB). I noticed, that the GIMP swap file grew to 2048MB, which is the 32-bit signed integer boundary, and then the GIMP crashed. System is Windows 2000 Professional with all updates. File system is NTFS.
Forgot to mention - the GIMP 2.3.12 also suffers from this bug
People should build gimp with large file support on Windows then. The source is prepared for this. Closing as NOTABUG.
Hmm, when you say "the source is prepared", what do you mean? As far as I see the source uses off_t for tile swap file offsets, which in the Microsoft C library is 32 bits. To use large files, one needs to use gint64 offsets, and a slightly different API (_lseeki64(), _telli64(), _stati64() etc). Sure, this sucks, but the Microsoft C library maintains binary compatibility back to the mid-90s, before Windows itself (?) supported large files. Unlike Solaris and Linux, it is not enough to just add a macro definition to the compilation to make all the file IO calls large file aware. Yeah, this sucks, too, as far as I see they could easily have made it work that way.
Then GLib should provide an abstraction layer for this.
Created attachment 81142 [details] [review] Suggested patch But until GLib does, how about this patch? Seems to work fine for me on XP. I created a 30000x30000 image and the tile swap file grew to over 10 GB when I filled it with a gradient;)
Why so complicated? Instead of defining LargeOffset, just use gint64 on all platforms. That would make the patch a lot smaller and the code more readable.
Created attachment 81163 [details] [review] Suggested patch Like this?
Looks good and compiles without warnings on Linux. Please commit.
Committed to trunk. Should we do this in the stable branch, too?
It's IMO too much of a change for the stable branch.
*** Bug 435384 has been marked as a duplicate of this bug. ***
*** Bug 442420 has been marked as a duplicate of this bug. ***