From ef77388a736ffbd3d41b324a60f32de255e10126 Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Wed, 21 Jan 2026 22:25:02 +0000 Subject: [PATCH] Force MSVC to use exception handling As of 8.18.0, libvips C++ wrapper retrieves error messages at exception construction time rather than lazily when accessed. On Windows this led to error messages being referenced rather than copied, leading to access beyond their lifetime and possible corruption. --- src/binding.gyp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/binding.gyp b/src/binding.gyp index 1673651b..64970726 100644 --- a/src/binding.gyp +++ b/src/binding.gyp @@ -21,6 +21,7 @@ 'defines': [ '_VIPS_PUBLIC=__declspec(dllexport)', '_ALLOW_KEYWORD_MACROS', + '_HAS_EXCEPTIONS=1', 'G_DISABLE_ASSERT', 'G_DISABLE_CAST_CHECKS', 'G_DISABLE_CHECKS' @@ -148,7 +149,8 @@ ['OS == "win"', { 'defines': [ '_ALLOW_KEYWORD_MACROS', - '_FILE_OFFSET_BITS=64' + '_FILE_OFFSET_BITS=64', + '_HAS_EXCEPTIONS=1' ], 'link_settings': { 'libraries': [