Hi Andreas,

thanks! I have found another bug and have attached a fix for it.
The problem is that if you call end() on an empty vector the current
implementation tries to de-reference a NULL pointer and crashes.

I'm submitting this patch under the MIT license.

Best regards and have a nice weekend,

Martin Fleisz
Thincast Technologies GmbH


diff --git include/iprt/nocrt/vector include/iprt/nocrt/vector
index 607a75097d3..bbb1acd9de3 100644
--- include/iprt/nocrt/vector
+++ include/iprt/nocrt/vector
@@ -259,17 +259,17 @@ namespace std
 
         iterator end() RT_NOEXCEPT
         {
-            return iterator(&m_paItems[m_cItems]);
+            return iterator(m_paItems + m_cItems);
         }
 
         const_iterator end() const RT_NOEXCEPT
         {
-            return const_iterator(&m_paItems[m_cItems]);
+            return const_iterator(m_paItems + m_cItems);
         }
 
         const_iterator cend() const RT_NOEXCEPT
         {
-            return const_iterator(&m_paItems[m_cItems]);
+            return const_iterator(m_paItems + m_cItems);
         }
         /** @} */
 


On 15.12.2022 14:39, Andreas Löffler wrote:
> Hello Martin,
>
> thanks for reporting this and for the fix! I'll take care of it.
>
>

-- 
Martin Fleisz, Development Manager

Thincast Technologies GmbH              Tel: +43-720-699 844-70
Bahnhofplatz 7/3                        Fax:   +43-2236-328 311
2340 Moedling, Austria                  http://www.thincast.com

_______________________________________________
vbox-dev mailing list
vbox-dev@virtualbox.org
https://www.virtualbox.org/mailman/listinfo/vbox-dev

Reply via email to