Index: trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp
===================================================================
--- trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp	(revision 104747)
+++ trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp	(revision 104748)
@@ -59,4 +59,27 @@
 // defines
 /////////////////////////////////////////////////////////////////////////////
+
+/** @def MY_VECTOR_ASSIGN_ARRAY
+ * Safe way to copy an array (static + const) into a vector w/ minimal typing.
+ *
+ * @param a_rVector     The destination vector reference.
+ * @param a_aSrcArray   The source array to assign to the vector.
+ */
+#if RT_GNUC_PREREQ(13, 0) && !RT_GNUC_PREREQ(14, 0) && defined(VBOX_WITH_GCC_SANITIZER)
+/* Workaround for g++ 13.2 incorrectly failing on arrays with a single entry in ASAN builds.
+   This is restricted to [13.0, 14.0), assuming the issue was introduced in the 13 cycle
+   and will be fixed by the time 14 is done.  If 14 doesn't fix it, extend the range
+   version by version till it is fixed. */
+# define MY_VECTOR_ASSIGN_ARRAY(a_rVector, a_aSrcArray) do { \
+        _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wstringop-overread\""); \
+        (a_rVector).assign(&a_aSrcArray[0], &a_aSrcArray[RT_ELEMENTS(a_aSrcArray)]); \
+        _Pragma("GCC diagnostic pop"); \
+    } while (0)
+#else
+# define MY_VECTOR_ASSIGN_ARRAY(a_rVector, a_aSrcArray) do { \
+        (a_rVector).assign(&a_aSrcArray[0], &a_aSrcArray[RT_ELEMENTS(a_aSrcArray)]); \
+    } while (0)
+#endif
+
 
 // constructor / destructor
@@ -1023,5 +1046,5 @@
 HRESULT SystemProperties::getSupportedPlatformArchitectures(std::vector<PlatformArchitecture_T> &aSupportedPlatformArchitectures)
 {
-    static const PlatformArchitecture_T aPlatformArchitectures[] =
+    static const PlatformArchitecture_T s_aPlatformArchitectures[] =
     {
 #if   defined(RT_ARCH_X86)   || defined(RT_ARCH_AMD64)
@@ -1039,6 +1062,5 @@
 #endif
     };
-    aSupportedPlatformArchitectures.assign(aPlatformArchitectures,
-                                           aPlatformArchitectures + RT_ELEMENTS(aPlatformArchitectures));
+    MY_VECTOR_ASSIGN_ARRAY(aSupportedPlatformArchitectures, s_aPlatformArchitectures);
     return S_OK;
 }
@@ -1046,5 +1068,5 @@
 HRESULT SystemProperties::getSupportedClipboardModes(std::vector<ClipboardMode_T> &aSupportedClipboardModes)
 {
-    static const ClipboardMode_T aClipboardModes[] =
+    static const ClipboardMode_T s_aClipboardModes[] =
     {
         ClipboardMode_Disabled,
@@ -1053,6 +1075,5 @@
         ClipboardMode_Bidirectional,
     };
-    aSupportedClipboardModes.assign(aClipboardModes,
-                                    aClipboardModes + RT_ELEMENTS(aClipboardModes));
+    MY_VECTOR_ASSIGN_ARRAY(aSupportedClipboardModes, s_aClipboardModes);
     return S_OK;
 }
@@ -1060,5 +1081,5 @@
 HRESULT SystemProperties::getSupportedDnDModes(std::vector<DnDMode_T> &aSupportedDnDModes)
 {
-    static const DnDMode_T aDnDModes[] =
+    static const DnDMode_T s_aDnDModes[] =
     {
         DnDMode_Disabled,
@@ -1067,6 +1088,5 @@
         DnDMode_Bidirectional,
     };
-    aSupportedDnDModes.assign(aDnDModes,
-                              aDnDModes + RT_ELEMENTS(aDnDModes));
+    MY_VECTOR_ASSIGN_ARRAY(aSupportedDnDModes, s_aDnDModes);
     return S_OK;
 }
@@ -1074,5 +1094,5 @@
 HRESULT SystemProperties::getSupportedPointingHIDTypes(std::vector<PointingHIDType_T> &aSupportedPointingHIDTypes)
 {
-    static const PointingHIDType_T aPointingHIDTypes[] =
+    static const PointingHIDType_T s_aPointingHIDTypes[] =
     {
         PointingHIDType_PS2Mouse,
@@ -1087,6 +1107,5 @@
         PointingHIDType_USBMultiTouchScreenPlusPad,
     };
-    aSupportedPointingHIDTypes.assign(aPointingHIDTypes,
-                                      aPointingHIDTypes + RT_ELEMENTS(aPointingHIDTypes));
+    MY_VECTOR_ASSIGN_ARRAY(aSupportedPointingHIDTypes, s_aPointingHIDTypes);
     return S_OK;
 }
@@ -1094,5 +1113,5 @@
 HRESULT SystemProperties::getSupportedKeyboardHIDTypes(std::vector<KeyboardHIDType_T> &aSupportedKeyboardHIDTypes)
 {
-    static const KeyboardHIDType_T aKeyboardHIDTypes[] =
+    static const KeyboardHIDType_T s_aKeyboardHIDTypes[] =
     {
         KeyboardHIDType_PS2Keyboard,
@@ -1102,6 +1121,5 @@
 #endif
     };
-    aSupportedKeyboardHIDTypes.assign(aKeyboardHIDTypes,
-                                      aKeyboardHIDTypes + RT_ELEMENTS(aKeyboardHIDTypes));
+    MY_VECTOR_ASSIGN_ARRAY(aSupportedKeyboardHIDTypes, s_aKeyboardHIDTypes);
     return S_OK;
 }
@@ -1109,5 +1127,5 @@
 HRESULT SystemProperties::getSupportedVFSTypes(std::vector<VFSType_T> &aSupportedVFSTypes)
 {
-    static const VFSType_T aVFSTypes[] =
+    static const VFSType_T s_aVFSTypes[] =
     {
         VFSType_File,
@@ -1118,6 +1136,5 @@
 #endif
     };
-    aSupportedVFSTypes.assign(aVFSTypes,
-                              aVFSTypes + RT_ELEMENTS(aVFSTypes));
+    MY_VECTOR_ASSIGN_ARRAY(aSupportedVFSTypes, s_aVFSTypes);
     return S_OK;
 }
@@ -1125,5 +1142,5 @@
 HRESULT SystemProperties::getSupportedImportOptions(std::vector<ImportOptions_T> &aSupportedImportOptions)
 {
-    static const ImportOptions_T aImportOptions[] =
+    static const ImportOptions_T s_aImportOptions[] =
     {
         ImportOptions_KeepAllMACs,
@@ -1131,6 +1148,5 @@
         ImportOptions_ImportToVDI,
     };
-    aSupportedImportOptions.assign(aImportOptions,
-                                   aImportOptions + RT_ELEMENTS(aImportOptions));
+    MY_VECTOR_ASSIGN_ARRAY(aSupportedImportOptions, s_aImportOptions);
     return S_OK;
 }
@@ -1138,5 +1154,5 @@
 HRESULT SystemProperties::getSupportedExportOptions(std::vector<ExportOptions_T> &aSupportedExportOptions)
 {
-    static const ExportOptions_T aExportOptions[] =
+    static const ExportOptions_T s_aExportOptions[] =
     {
         ExportOptions_CreateManifest,
@@ -1145,6 +1161,5 @@
         ExportOptions_StripAllNonNATMACs,
     };
-    aSupportedExportOptions.assign(aExportOptions,
-                                   aExportOptions + RT_ELEMENTS(aExportOptions));
+    MY_VECTOR_ASSIGN_ARRAY(aSupportedExportOptions, s_aExportOptions);
     return S_OK;
 }
@@ -1153,5 +1168,5 @@
 {
 #ifdef VBOX_WITH_RECORDING
-    static const RecordingFeature_T aRecordingFeatures[] =
+    static const RecordingFeature_T s_aRecordingFeatures[] =
     {
 # ifdef VBOX_WITH_AUDIO_RECORDING
@@ -1160,6 +1175,5 @@
         RecordingFeature_Video,
     };
-    aSupportedRecordingFeatures.assign(aRecordingFeatures,
-                                       aRecordingFeatures + RT_ELEMENTS(aRecordingFeatures));
+    MY_VECTOR_ASSIGN_ARRAY(aSupportedRecordingFeatures, s_aRecordingFeatures);
 #else  /* !VBOX_WITH_RECORDING */
     aSupportedRecordingFeatures.clear();
@@ -1170,5 +1184,5 @@
 HRESULT SystemProperties::getSupportedRecordingAudioCodecs(std::vector<RecordingAudioCodec_T> &aSupportedRecordingAudioCodecs)
 {
-    static const RecordingAudioCodec_T aRecordingAudioCodecs[] =
+    static const RecordingAudioCodec_T s_aRecordingAudioCodecs[] =
     {
         RecordingAudioCodec_None,
@@ -1180,6 +1194,5 @@
 #endif
     };
-    aSupportedRecordingAudioCodecs.assign(aRecordingAudioCodecs,
-                                          aRecordingAudioCodecs + RT_ELEMENTS(aRecordingAudioCodecs));
+    MY_VECTOR_ASSIGN_ARRAY(aSupportedRecordingAudioCodecs, s_aRecordingAudioCodecs);
     return S_OK;
 }
@@ -1187,5 +1200,5 @@
 HRESULT SystemProperties::getSupportedRecordingVideoCodecs(std::vector<RecordingVideoCodec_T> &aSupportedRecordingVideoCodecs)
 {
-    static const RecordingVideoCodec_T aRecordingVideoCodecs[] =
+    static const RecordingVideoCodec_T s_aRecordingVideoCodecs[] =
     {
         RecordingVideoCodec_None,
@@ -1198,6 +1211,5 @@
 #endif
     };
-    aSupportedRecordingVideoCodecs.assign(aRecordingVideoCodecs,
-                                          aRecordingVideoCodecs + RT_ELEMENTS(aRecordingVideoCodecs));
+    MY_VECTOR_ASSIGN_ARRAY(aSupportedRecordingVideoCodecs, s_aRecordingVideoCodecs);
     return S_OK;
 }
@@ -1205,5 +1217,5 @@
 HRESULT SystemProperties::getSupportedRecordingVSModes(std::vector<RecordingVideoScalingMode_T> &aSupportedRecordingVideoScalingModes)
 {
-    static const RecordingVideoScalingMode_T aRecordingVideoScalingModes[] =
+    static const RecordingVideoScalingMode_T s_aRecordingVideoScalingModes[] =
     {
         RecordingVideoScalingMode_None,
@@ -1214,6 +1226,5 @@
 #endif
     };
-    aSupportedRecordingVideoScalingModes.assign(aRecordingVideoScalingModes,
-                                                aRecordingVideoScalingModes + RT_ELEMENTS(aRecordingVideoScalingModes));
+    MY_VECTOR_ASSIGN_ARRAY(aSupportedRecordingVideoScalingModes, s_aRecordingVideoScalingModes);
     return S_OK;
 }
@@ -1221,5 +1232,5 @@
 HRESULT SystemProperties::getSupportedRecordingARCModes(std::vector<RecordingRateControlMode_T> &aSupportedRecordingAudioRateControlModes)
 {
-    static const RecordingRateControlMode_T aRecordingAudioRateControlModes[] =
+    static const RecordingRateControlMode_T s_aRecordingAudioRateControlModes[] =
     {
 #ifdef DEBUG
@@ -1229,6 +1240,5 @@
         RecordingRateControlMode_VBR
     };
-    aSupportedRecordingAudioRateControlModes.assign(aRecordingAudioRateControlModes,
-                                                    aRecordingAudioRateControlModes + RT_ELEMENTS(aRecordingAudioRateControlModes));
+    MY_VECTOR_ASSIGN_ARRAY(aSupportedRecordingAudioRateControlModes, s_aRecordingAudioRateControlModes);
     return S_OK;
 }
@@ -1236,5 +1246,5 @@
 HRESULT SystemProperties::getSupportedRecordingVRCModes(std::vector<RecordingRateControlMode_T> &aSupportedRecordingVideoRateControlModes)
 {
-    static const RecordingRateControlMode_T aRecordingVideoRateControlModes[] =
+    static const RecordingRateControlMode_T s_aRecordingVideoRateControlModes[] =
     {
 #ifdef DEBUG
@@ -1244,6 +1254,5 @@
         RecordingRateControlMode_VBR
     };
-    aSupportedRecordingVideoRateControlModes.assign(aRecordingVideoRateControlModes,
-                                                    aRecordingVideoRateControlModes + RT_ELEMENTS(aRecordingVideoRateControlModes));
+    MY_VECTOR_ASSIGN_ARRAY(aSupportedRecordingVideoRateControlModes, s_aRecordingVideoRateControlModes);
     return S_OK;
 }
@@ -1251,5 +1260,5 @@
 HRESULT SystemProperties::getSupportedCloneOptions(std::vector<CloneOptions_T> &aSupportedCloneOptions)
 {
-    static const CloneOptions_T aCloneOptions[] =
+    static const CloneOptions_T s_aCloneOptions[] =
     {
         CloneOptions_Link,
@@ -1259,6 +1268,5 @@
         CloneOptions_KeepHwUUIDs,
     };
-    aSupportedCloneOptions.assign(aCloneOptions,
-                                  aCloneOptions + RT_ELEMENTS(aCloneOptions));
+    MY_VECTOR_ASSIGN_ARRAY(aSupportedCloneOptions, s_aCloneOptions);
     return S_OK;
 }
@@ -1266,5 +1274,5 @@
 HRESULT SystemProperties::getSupportedAutostopTypes(std::vector<AutostopType_T> &aSupportedAutostopTypes)
 {
-    static const AutostopType_T aAutostopTypes[] =
+    static const AutostopType_T s_aAutostopTypes[] =
     {
         AutostopType_Disabled,
@@ -1273,6 +1281,5 @@
         AutostopType_AcpiShutdown,
     };
-    aSupportedAutostopTypes.assign(aAutostopTypes,
-                                   aAutostopTypes + RT_ELEMENTS(aAutostopTypes));
+    MY_VECTOR_ASSIGN_ARRAY(aSupportedAutostopTypes, s_aAutostopTypes);
     return S_OK;
 }
@@ -1280,5 +1287,5 @@
 HRESULT SystemProperties::getSupportedVMProcPriorities(std::vector<VMProcPriority_T> &aSupportedVMProcPriorities)
 {
-    static const VMProcPriority_T aVMProcPriorities[] =
+    static const VMProcPriority_T s_aVMProcPriorities[] =
     {
         VMProcPriority_Default,
@@ -1288,6 +1295,5 @@
         VMProcPriority_High,
     };
-    aSupportedVMProcPriorities.assign(aVMProcPriorities,
-                                      aVMProcPriorities + RT_ELEMENTS(aVMProcPriorities));
+    MY_VECTOR_ASSIGN_ARRAY(aSupportedVMProcPriorities, s_aVMProcPriorities);
     return S_OK;
 }
@@ -1295,5 +1301,5 @@
 HRESULT SystemProperties::getSupportedNetworkAttachmentTypes(std::vector<NetworkAttachmentType_T> &aSupportedNetworkAttachmentTypes)
 {
-    static const NetworkAttachmentType_T aNetworkAttachmentTypes[] =
+    static const NetworkAttachmentType_T s_aNetworkAttachmentTypes[] =
     {
         NetworkAttachmentType_NAT,
@@ -1311,6 +1317,5 @@
         NetworkAttachmentType_Null,
     };
-    aSupportedNetworkAttachmentTypes.assign(aNetworkAttachmentTypes,
-                                            aNetworkAttachmentTypes + RT_ELEMENTS(aNetworkAttachmentTypes));
+    MY_VECTOR_ASSIGN_ARRAY(aSupportedNetworkAttachmentTypes, s_aNetworkAttachmentTypes);
     return S_OK;
 }
@@ -1318,5 +1323,5 @@
 HRESULT SystemProperties::getSupportedPortModes(std::vector<PortMode_T> &aSupportedPortModes)
 {
-    static const PortMode_T aPortModes[] =
+    static const PortMode_T s_aPortModes[] =
     {
         PortMode_Disconnected,
@@ -1326,6 +1331,5 @@
         PortMode_TCP,
     };
-    aSupportedPortModes.assign(aPortModes,
-                               aPortModes + RT_ELEMENTS(aPortModes));
+    MY_VECTOR_ASSIGN_ARRAY(aSupportedPortModes, s_aPortModes);
     return S_OK;
 }
@@ -1333,5 +1337,5 @@
 HRESULT SystemProperties::getSupportedAudioDriverTypes(std::vector<AudioDriverType_T> &aSupportedAudioDriverTypes)
 {
-    static const AudioDriverType_T aAudioDriverTypes[] =
+    static const AudioDriverType_T s_aAudioDriverTypes[] =
     {
         AudioDriverType_Default,
@@ -1365,6 +1369,5 @@
         AudioDriverType_Null,
     };
-    aSupportedAudioDriverTypes.assign(aAudioDriverTypes,
-                                      aAudioDriverTypes + RT_ELEMENTS(aAudioDriverTypes));
+    MY_VECTOR_ASSIGN_ARRAY(aSupportedAudioDriverTypes, s_aAudioDriverTypes);
     return S_OK;
 }
@@ -1378,5 +1381,5 @@
         case CPUArchitecture_AMD64:
         {
-            static const VMExecutionEngine_T aExecEngines[] =
+            static const VMExecutionEngine_T s_aExecEngines[] =
             {
                 VMExecutionEngine_Default,
@@ -1394,6 +1397,5 @@
 #endif
             };
-            aExecutionEngines.assign(aExecEngines,
-                                     aExecEngines + RT_ELEMENTS(aExecEngines));
+            MY_VECTOR_ASSIGN_ARRAY(aExecutionEngines, s_aExecEngines);
             break;
         }
@@ -1413,6 +1415,5 @@
 # endif
             };
-            aExecutionEngines.assign(aExecEngines,
-                                     aExecEngines + RT_ELEMENTS(aExecEngines));
+            MY_VECTOR_ASSIGN_ARRAY(aExecutionEngines, s_aExecEngines);
 #else
             aExecutionEngines.clear();
