Skip to content

ImageMagick sample: move to Magick.NET 14.17.1 for security fixes - #2237

Open
vladimir-pecanac-main wants to merge 1 commit into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/116578-csharp-generate-images-using-imagemagick
Open

vladimir-pecanac-main wants to merge 1 commit into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/116578-csharp-generate-images-using-imagemagick

Conversation

@vladimir-pecanac-main

Copy link
Copy Markdown
Collaborator

Security update for the csharp-images/GenerateImagesInCSharpUsingImageMagick sample, which backs the "Generate Images in C# Using ImageMagick" article.

The sample pinned Magick.NET-Q8-AnyCPU 13.6.0. The GitHub advisory database lists 162 advisories that affect 13.6.0 (26 high, 98 medium, 38 low), published between July 2025 and September 2026 and all fixed by 14.15.0. A few of them: CVE-2026-23952 (fixed in 14.10.2), CVE-2026-46692 (14.12.0), CVE-2026-49219 (14.14.0), CVE-2026-55594 (14.15.0). This moves the sample to 14.17.1, the newest release, which has no open advisory.

Magick.NET 14 takes image sizes as uint and moves Drawables to the ImageMagick.Drawing namespace, so the sample does not compile on 14.x as written. Behaviour is unchanged.

Four files, one folder.

  • ImageMagickLibrary.csproj: Magick.NET-Q8-AnyCPU 13.6.0 to 14.17.1.
  • ImageService.cs: using ImageMagick.Drawing;, and CreateBlankImage takes uint width, uint height to match the MagickImage(color, uint, uint) constructor. A zero size still throws ArgumentException.
  • Program.cs: image.Width and image.Height are uint now, so they are cast to int before they go to CreateCircle.
  • Tests/ImageMagickLibraryLiveTest.cs: the same casts on MagickGeometry.Width and Height, and the invalid-size theory takes uint.

The target framework stays net8.0 and the test packages are unchanged; neither had to move for this.

dotnet build -c Release: 0 warnings, 0 errors. dotnet test (all tests, including the Live ones CI filters out): 7 of 7 passed. SDK 10.0.302, runtime 8.0.27. The program still writes the 480 x 300 AliceBlue image with the YellowGreen circle.

Magick.NET-Q8-AnyCPU 13.6.0 is affected by 162 published advisories, all
fixed by 14.15.0. Version 14 takes image sizes as uint and moves Drawables
to ImageMagick.Drawing, so the sample gets the matching signature, casts
and using directive. Behaviour is unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant