RFR(XS) 8191852: Null pointer dereference in ciKlass::get_Klass of ciKlass.hpp:58

Vladimir Kozlov vladimir.kozlov at oracle.com
Wed Dec 13 21:08:41 UTC 2017


On 12/13/17 12:45 PM, dean.long at oracle.com wrote:
> https://bugs.openjdk.java.net/browse/JDK-8191852
> http://cr.openjdk.java.net/~dlong/8191852/webrev/
> 
> Our static analysis tool was complaining about a possible null pointer 
> dereference in ciKlass::get_Klass(), because of this code:
> 
> 237.      _holder = CURRENT_ENV->get_instance_klass(fd->field_holder());
> [...]
> 240.      Klass* k = _holder->get_Klass();
> 
> so I added NULL checks in get_instance_klass and a few other similar 
> functions.

No, you don't ;)
You replaced NULL checks which return NULL with asserts. It is not the 
same. Are you sure that in all those cases we will not get NULL?

Thanks,
Vladimir

> 
> dl


More information about the hotspot-compiler-dev mailing list