vtil-project / VTIL-Core

Virtual-machine Translation Intermediate Language
BSD 3-Clause "New" or "Revised" License
1.31k stars 165 forks source link

Stack overflow during simpilfication. #7

Closed zzz9328fb closed 4 years ago

zzz9328fb commented 4 years ago

void test_vtil_crash() { expression X_00, X_01, X_02, X_03; expression a,b,c; X_00 = expression(unique_identifier("X_00"), 1); X_01 = expression(unique_identifier("X_01"), 1); X_02 = expression(unique_identifier("X_02"), 1); X_03 = expression(unique_identifier("X_03"), 1); a = ~(((X_03 & X_00) ^ (X_02 & X_01)) & (X_01 & X_00)); b = ((X_03 & X_00) ^ (X_02 & X_01)); printf("a = %s\n", a.to_string().c_str()); printf("b = %s\n", b.to_string().c_str()); c = ~(a & b); //crash at here printf("c = %s\n", c.to_string().c_str()); }

can1357 commented 4 years ago

Hey, seems like there's an invalid directive causing a stack overflow, checking it right now, will fix and let you know in 1-2 hours.

can1357 commented 4 years ago
expression X_00 = { {"X_00"}, 1 }; 
expression X_01 = { {"X_01"}, 1 }; 
expression X_02 = { {"X_02"}, 1 }; 
expression X_03 = { {"X_03"}, 1 };

expression a = ~( ( ( X_03 & X_00 ) ^ ( X_02 & X_01 ) ) & ( X_01 & X_00 ) );
log( "a = %s\n", a.to_string() );

expression b = ( ( X_03 & X_00 ) ^ ( X_02 & X_01 ) );
log( "b = %s\n", b.to_string() );

expression c = ~( a & b );
log( "c = %s\n", c.to_string() );

Snippet above produces the result below now:

a = ~(((X_03&X_00)^(X_02&X_01))&(X_01&X_00)) b = ((X_03&X_00)^(X_02&X_01)) c = (~((X_03&X_00)^(X_02&X_01))|(X_01&X_00))

Thanks for creating the issue and let me know if you experience any other problems :)