yuejia / Milu

A higher order mutation testing tool
Other
58 stars 29 forks source link

fix_function_attribute and clean_ast functions causing problems to the AST #17

Open oscarcornejolu opened 4 years ago

oscarcornejolu commented 4 years ago

I'm trying to generate mutants for the following source code:

#include <stdio.h>
#include <stdlib.h>

void func() {
  int a = 5 ;
  int b = 2;
  int ret = 0 ;

  if(a<b){
    ret = a;
  }
  if(a>b){
    ret = b;
  }
  printf( "Max value is : %d\n", ret );
}

void main(int argc, char** argv){
  func();
  exit();
}

When launching Milu with the parameter '--func-name=func', I'm obtaining a segmentation fault in the line if(g_strcmp0(func_name, tmp_node->text)==0) of the milu_project_load_function_settings function in Project.c. In particular, gdb says the following about tmp_node->text variable:

$1 = (gchar *) 0xe <Address 0xe out of bounds>

However, if within the function 'libclang_parse_file' in ASTUnit.c I comment the 'fix_function_attribute' and the 'clean_ast' calls I get Milu to work and to correctly produce mutants.

Do you know how to fix those both functions to make work Milu correctly? Thanks in advance,