Jump to content
sumit_tuwien

De-reference of null pointer in SystemC Library

Recommended Posts

Hi All,

 

We have observed  Dereference of null pointer in following files :

 

sysc/datatypes/int/sc_uint_base.cpp: line 515 
sysc/datatypes/int/sc_unsigned.cpp: line 463 
sysc/datatypes/int/sc_signed.cpp: line 479 
sysc/datatypes/int/sc_int_base.cpp: line 544 
sysc/datatypes/bit/sc_bv_base.cpp: line 315 
 
Everywhere the problem is with:
 
    if( *a == 0 ) {
 
Regards, Sumit
 

Share this post


Link to post
Share on other sites

If you look at these parts of the code, you'll see that the pointer is checked for NULL right before.  The static analysis tool just doesn't know that SC_REPORT_ERROR does not return (instead, it throws an exception by default).

 

Therefore, all of these can be seen as false positives.

 

/Philipp

Share this post


Link to post
Share on other sites

Thanks Philipp,

 

This is a false positive.

 

But, you just helped me to find a bug which I introduced. I deleted SC_REPORT_ERROR and forgot to add something !!!

 

Sorry for creating confusion which arose out of two different libraries.

 

Many thanks for that.

 

Regards, Sumit

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×