You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've run into an issue when using long file paths (a path longer than 260 chars). The symptom suggests an issue with ImageMagick, but thought I'd start here.
Using new MagickImage(filename, settings) to open an image, if filename is a long path name, we will get a STATUS_HEAP_CORRUPTION error. On 64-bit processes, this is an immediate process shutdown (cannot be caught).
This is a minor issue for our project, as it can be worked around (by using File.ReadAllBytes and passing the byte array to ImageMagick).
Interestingly, if the path provided points to a file which doesn't exist, there is no issue. So the issue occurs in the "success" code path.
Steps to Reproduce
// filename is a path to an image, path is > 260 characters long
var settings = new MagickReadSettings();
using (var imgM = new MagickImage(filename, settings))
{
Bitmap bitmap = imgM.ToBitmap();
}
System Configuration
Windows 10, builds 1803, 1809.
The behavior is not impacted by the "Enable Win32 long paths" setting.
.NET Framework 4.7.1
Magick.NET version: Q16-AnyCPU: 7.12.0.0; 7.13.1
The text was updated successfully, but these errors were encountered:
Thank you for finding this bug! ImageMagick calls GetShortPathNameW to get the 8.3 alias for the specified path. But it appears that it is possible that the 8.3 alias does not exist. I just pushed some patches to the ImageMagick repository to add some extra checks for this. And I have also added a check to test if HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled (https://docs.microsoft.com/nl-nl/windows/desktop/FileIO/naming-a-file#maximum-path-length-limitation) is set to true and don't call GetShortPathNameW then. This issue will be resolved in the next release of Magick.NET.
Description
I've run into an issue when using long file paths (a path longer than 260 chars). The symptom suggests an issue with ImageMagick, but thought I'd start here.
Using
new MagickImage(filename, settings)
to open an image, if filename is a long path name, we will get a STATUS_HEAP_CORRUPTION error. On 64-bit processes, this is an immediate process shutdown (cannot be caught).This is a minor issue for our project, as it can be worked around (by using
File.ReadAllBytes
and passing the byte array to ImageMagick).Interestingly, if the path provided points to a file which doesn't exist, there is no issue. So the issue occurs in the "success" code path.
Steps to Reproduce
System Configuration
Windows 10, builds 1803, 1809.
The behavior is not impacted by the "Enable Win32 long paths" setting.
.NET Framework 4.7.1
The text was updated successfully, but these errors were encountered: