From 266a892cda9a41e3cd5c39085c5e011a47240799 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Fri, 25 Sep 2026 12:23:52 +0200 Subject: [PATCH] Unix: preserve derived UI exception types Check MissingArgument, NoItemSelected, and StringFormatterException before UserInterfaceException in both rethrow helpers. This prevents slicing and preserves their specific exception types and diagnostics. --- src/Main/Forms/WaitDialog.cpp | 3 ++- src/Main/UserInterface.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Main/Forms/WaitDialog.cpp b/src/Main/Forms/WaitDialog.cpp index 9d233e1f..579df614 100644 --- a/src/Main/Forms/WaitDialog.cpp +++ b/src/Main/Forms/WaitDialog.cpp @@ -64,10 +64,11 @@ namespace VeraCrypt VC_CONVERT_EXCEPTION (UnsupportedSectorSizeNoKernelCrypto); VC_CONVERT_EXCEPTION (VolumeAlreadyMounted); VC_CONVERT_EXCEPTION (VolumeSlotUnavailable); - VC_CONVERT_EXCEPTION (UserInterfaceException); + // Handle UserInterfaceException subclasses before the base class to avoid slicing. VC_CONVERT_EXCEPTION (MissingArgument); VC_CONVERT_EXCEPTION (NoItemSelected); VC_CONVERT_EXCEPTION (StringFormatterException); + VC_CONVERT_EXCEPTION (UserInterfaceException); VC_CONVERT_EXCEPTION (FilesystemDismountFailed); VC_CONVERT_EXCEPTION (ExecutedProcessFailed); VC_CONVERT_EXCEPTION (AlreadyInitialized); diff --git a/src/Main/UserInterface.cpp b/src/Main/UserInterface.cpp index 2a5fd71a..feb40978 100644 --- a/src/Main/UserInterface.cpp +++ b/src/Main/UserInterface.cpp @@ -1903,10 +1903,11 @@ const FileManager fileManagers[] = { VC_CONVERT_EXCEPTION (UnsupportedSectorSizeNoKernelCrypto); VC_CONVERT_EXCEPTION (VolumeAlreadyMounted); VC_CONVERT_EXCEPTION (VolumeSlotUnavailable); - VC_CONVERT_EXCEPTION (UserInterfaceException); + // Handle UserInterfaceException subclasses before the base class to avoid slicing. VC_CONVERT_EXCEPTION (MissingArgument); VC_CONVERT_EXCEPTION (NoItemSelected); VC_CONVERT_EXCEPTION (StringFormatterException); + VC_CONVERT_EXCEPTION (UserInterfaceException); VC_CONVERT_EXCEPTION (FilesystemDismountFailed); VC_CONVERT_EXCEPTION (ExecutedProcessFailed); VC_CONVERT_EXCEPTION (AlreadyInitialized);