From 164d308c6e4edaf2c15b052e7562756c3fea734f Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Sat, 25 May 2024 10:52:38 +0200 Subject: [PATCH] Ensure variadic call is null-terminated --- samples/NetVips.Samples/Samples/GenerateImageClass.cs | 7 ++++--- src/NetVips/Image.cs | 2 +- src/NetVips/Internal/Vips.cs | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/samples/NetVips.Samples/Samples/GenerateImageClass.cs b/samples/NetVips.Samples/Samples/GenerateImageClass.cs index 847963ba..ce4b0e14 100644 --- a/samples/NetVips.Samples/Samples/GenerateImageClass.cs +++ b/samples/NetVips.Samples/Samples/GenerateImageClass.cs @@ -776,12 +776,13 @@ private string Generate(string indent = " ") // remove operations we have to wrap by hand var exclude = new[] { - "scale", - "ifthenelse", + "addalpha", "bandjoin", "bandrank", + "case", "composite", - "case" + "ifthenelse", + "scale" }; // get the list of all nicknames we can generate docstrings for. diff --git a/src/NetVips/Image.cs b/src/NetVips/Image.cs index d7ac389f..9ba52d9a 100644 --- a/src/NetVips/Image.cs +++ b/src/NetVips/Image.cs @@ -2036,7 +2036,7 @@ public Image AddAlpha() // use `vips_addalpha` on libvips >= 8.6. if (NetVips.AtLeastLibvips(8, 6)) { - var result = VipsImage.AddAlpha(this, out var vi); + var result = VipsImage.AddAlpha(this, out var vi, IntPtr.Zero); if (result != 0) { throw new VipsException("unable to append alpha channel to image."); diff --git a/src/NetVips/Internal/Vips.cs b/src/NetVips/Internal/Vips.cs index 4f28f4a5..085542da 100644 --- a/src/NetVips/Internal/Vips.cs +++ b/src/NetVips/Internal/Vips.cs @@ -451,7 +451,7 @@ internal static extern IntPtr NewFromMemoryCopy(IntPtr data, UIntPtr size, int w [SuppressUnmanagedCodeSecurity] [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl, EntryPoint = "vips_addalpha")] - internal static extern int AddAlpha(Image image, out IntPtr @out); + internal static extern int AddAlpha(Image image, out IntPtr @out, IntPtr args); [SuppressUnmanagedCodeSecurity] [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,