Hi Martin,

great findings! I also will take care of those.

Thanks again!


--
Kind regards / Mit freundlichen Grüßen

******************************************************************
Andreas Löffler | VirtualBox Engineering
Principal Software Engineer | Oracle Virtualization

Oracle Global Services Germany GmbH
Riesstr. 25, D-80992 München
Registergericht: Amtsgericht München, HRB 246209
Geschäftsführer: Ralf Herrmann

Green Oracle <http://www.oracle.com/commitment> <http://www.oracle.com/commitment%3e>; Oracle is committed to developing practices and products that help protect the environment




On 16.12.22 09:42, Martin Fleisz wrote:
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.



Attachment: OpenPGP_0x46BCB4E5EE437BAD.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

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

Reply via email to