Fraunhofer-AISEC / codyze

Codyze is a static analyzer for Java, C, C++ based on code property graphs

Home Page:https://www.codyze.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A null pointer exception is thrown when the ControlFlowGraphPass is registered

Cglasses opened this issue · comments

Test Code

extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
void reach_error() { __assert_fail("0", "array_doub_access_init_const.c", 3, "reach_error"); }
extern void abort(void);
void assume_abort_if_not(int cond) {
  if(!cond) {abort();}
}
void __VERIFIER_assert(int cond) { if(!(cond)) { ERROR: {reach_error();abort();} } }
int main()
{
  int i;
  int N=100000;
  int a[2*N+2];

  for(i=0;i<=N;i++) {
    a[2*i]=0;
    a[2*i+1]=0;
  }

  for(i=0;i<=2*N;i++)
    __VERIFIER_assert(a[i]>=0);
  return 0;
}

When I try to register ControlFlowGraphPass, the log shows that CXXLanguageFrontend Transform to CPG can be done, but then a null pointer exception will be thrown.
1
However when I unregister that Pass, it works.

Thank you for reporting this bug. I took the liberty and reformatted your code sample.

I'll take a look and come back to you.

The control flow pass is deprecated and we should really remove it or mark as deprecated in CPG.

The control flow pass is deprecated and we should really remove it or mark as deprecated in CPG.

Ok, thank you.