[vbox-dev] [PATCH 1/8] Fix misused Assert*() macros

Frank Mehnert frank.mehnert at oracle.com
Thu Mar 26 09:08:52 UTC 2015


On Friday 13 March 2015 16:56:47 Jung-uk Kim wrote:
> include/VBox/com/array.h
> - fixes for null-pointer dereferences.

that's difficult. I know that compilers and static code checking tools
complain but the intention behind these statements is to return NULL
in case we are trying to access a NULL array or an index outside of
the current array dimensions. Returning NULL to the caller will either
be handled correctly by the caller or it will crash the application
in a controlled way. Otherwise we would risk heap corruption which is
hard to debug.

But I know that many tools are not happy with these statements...

> src/VBox/Runtime/common/ldr/ldrELFRelocatable.cpp.h
> - fixes misused AssertReturn().

This is definitely a bug but we have to discuss internally if your fix
is correct. Perhaps using AssertMsgReturn() would be more appropriate.

> src/VBox/VMM/VMMR3/PDMDriver.cpp
> - fixes misused AssertLogRelReturn().

Correct. Applied.


Dr.-Ing. Frank Mehnert | Software Development Director, VirtualBox
ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | 71384 Weinstadt, Germany

Hauptverwaltung: Riesstr. 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603
Geschäftsführer: Jürgen Kunz

Komplementärin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Geschäftsführer: Alexander van der Ven, Astrid Kepper, Val Maher

More information about the vbox-dev mailing list