Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
b2c174b5
Commit
b2c174b5
authored
3 years ago
by
Andre Maroneze
Browse files
Options
Downloads
Patches
Plain Diff
[Obfuscate] avoid crash when modifying global lemmas
parent
9a5b63ce
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/plugins/obfuscator/obfuscate.ml
+1
-1
1 addition, 1 deletion
src/plugins/obfuscator/obfuscate.ml
tests/misc/obfuscate.c
+6
-0
6 additions, 0 deletions
tests/misc/obfuscate.c
tests/misc/oracle/obfuscate.res.oracle
+27
-0
27 additions, 0 deletions
tests/misc/oracle/obfuscate.res.oracle
with
34 additions
and
1 deletion
src/plugins/obfuscator/obfuscate.ml
+
1
−
1
View file @
b2c174b5
...
@@ -290,7 +290,7 @@ end
...
@@ -290,7 +290,7 @@ end
let
obfuscate
()
=
let
obfuscate
()
=
Dictionary
.
mark_as_computed
()
;
Dictionary
.
mark_as_computed
()
;
obfuscate_behaviors
()
;
obfuscate_behaviors
()
;
Visitor
.
visitFramacFile
SameGlobals
Visitor
.
visitFramacFile
(
new
visitor
:>
Visitor
.
frama_c_visitor
)
(
new
visitor
:>
Visitor
.
frama_c_visitor
)
(
Ast
.
get
()
);
(
Ast
.
get
()
);
Printer
.
update_printer
(
module
UpdatePrinter
:
Printer
.
PrinterExtension
)
Printer
.
update_printer
(
module
UpdatePrinter
:
Printer
.
PrinterExtension
)
...
...
This diff is collapsed.
Click to expand it.
tests/misc/obfuscate.c
+
6
−
0
View file @
b2c174b5
...
@@ -72,3 +72,9 @@ void implem(int c, int d) { };
...
@@ -72,3 +72,9 @@ void implem(int c, int d) { };
struct
S
example_struct
=
{
.
my_func
=
implem
};
struct
S
example_struct
=
{
.
my_func
=
implem
};
void
test_func
(
struct
S
*
s
)
{
s
->
my_func
(
3
,
4
);
example_struct
.
my_func
(
5
,
6
);
}
void
test_func
(
struct
S
*
s
)
{
s
->
my_func
(
3
,
4
);
example_struct
.
my_func
(
5
,
6
);
}
// Check that these definitions do not make obfuscate crash
/*@ axiomatic A { predicate P(void (*galois_fp_old)()); } */
/*@ axiomatic A1 { predicate P1(void (*galois_fp_old)()); } */
void
my_f
()
{}
/*@ lemma OK: P(my_f) && P1(my_f); */
This diff is collapsed.
Click to expand it.
tests/misc/oracle/obfuscate.res.oracle
+
27
−
0
View file @
b2c174b5
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
[obfuscator] Warning: unobfuscated attribute name `fc_stdlib'
[obfuscator] Warning: unobfuscated attribute name `fc_stdlib'
[obfuscator] Warning: unobfuscated attribute parameter name `stdint.h'
[obfuscator] Warning: unobfuscated attribute parameter name `stdint.h'
[obfuscator] Warning: unobfuscated attribute name `missingproto'
[obfuscator] Warning: unobfuscated attribute name `missingproto'
[obfuscator] Warning: unobfuscated axiomatic name `A'
[obfuscator] Warning: unobfuscated axiomatic name `A1'
[obfuscator] Warning: unobfuscated lemma name `OK'
/* *********************************** */
/* *********************************** */
/* start of dictionary for obfuscation */
/* start of dictionary for obfuscation */
/* *********************************** */
/* *********************************** */
...
@@ -18,6 +21,7 @@
...
@@ -18,6 +21,7 @@
#define F4 builtin_and_stdlib
#define F4 builtin_and_stdlib
#define F5 implem
#define F5 implem
#define F6 test_func
#define F6 test_func
#define F7 my_f
// global variables
// global variables
#define G1 my_var
#define G1 my_var
#define G2 example_struct
#define G2 example_struct
...
@@ -32,6 +36,10 @@
...
@@ -32,6 +36,10 @@
// logic variables
// logic variables
#define LV1 I
#define LV1 I
#define LV2 x
#define LV2 x
#define LV3 P
#define LV4 galois_fp_old
#define LV5 P1
#define LV6 galois_fp_old
// fields
// fields
#define M1 my_func
#define M1 my_func
// predicates
// predicates
...
@@ -164,4 +172,23 @@ void F6(struct T2 *f6)
...
@@ -164,4 +172,23 @@ void F6(struct T2 *f6)
return;
return;
}
}
/*@ axiomatic A {
predicate LV3(void (*LV4)()) ;
}
*/
/*@ axiomatic A1 {
predicate LV5(void (*LV6)()) ;
}
*/
void F7(void)
{
return;
}
/*@ lemma OK{L}: LV3((void (*)())(&F7)) ∧ LV5((void (*)())(&F7));
*/
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment