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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...