Access Violation with abolish

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Access Violation with abolish

Gustavo Brown - INCO
I am getting an access violation when trying to abolish some facts.
All the functions involved are from the file dynam_supp.c file (BipsPL)
 
Inspecting the code (dynam_supp.c) I think the problem is that there is a special marker (ALL_MUST_BE_ERASED) with value 2 that is used in Erase_All to mark that you want to erase all clauses(in member first_erased_cl).
However, when Clean_Erased_Clauses() is called it may be the case that the the first_erased_cl is also marked to keep (because it is still used in the local stack) leading to keep member first_erased_cl with ALL_MUST_BE_ERASED and not its previous value.
 
Now, if PlDelete_Dynamic_Clause is called (e.g. due to a retract), then member next_erased_cl might be copied with that special value ALL_MUST_BE_ERASED.
 
Then if Clean_Erased_Clauses() is called again and now this snippet fails
for (clause = dyn->first_erased_cl; clause; clause = clause1)
 {
   clause1 = clause->next_erased_cl;
   size_of_erased -= clause->term_size;
   Unlink_Clause(clause);
   Free_Clause(clause);
 }
 
because clause->next_erased_cl might hold ALL_MUST_BE_ERASED instead of NULL, which is the stopping condition of that for loop.
 
Using GNU Prolog 1.4.4
 
Regards,
   Gustavo

_______________________________________________
Bug-prolog mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-prolog
Reply | Threaded
Open this post in threaded view
|

Re: Access Violation with abolish

Daniel Diaz-3
thank you for this bug report.

I look at it asap.

Daniel


Le 01/07/2015 22:05, Gustavo Brown - INCO a écrit :
I am getting an access violation when trying to abolish some facts.
All the functions involved are from the file dynam_supp.c file (BipsPL)
 
Inspecting the code (dynam_supp.c) I think the problem is that there is a special marker (ALL_MUST_BE_ERASED) with value 2 that is used in Erase_All to mark that you want to erase all clauses(in member first_erased_cl).
However, when Clean_Erased_Clauses() is called it may be the case that the the first_erased_cl is also marked to keep (because it is still used in the local stack) leading to keep member first_erased_cl with ALL_MUST_BE_ERASED and not its previous value.
 
Now, if PlDelete_Dynamic_Clause is called (e.g. due to a retract), then member next_erased_cl might be copied with that special value ALL_MUST_BE_ERASED.
 
Then if Clean_Erased_Clauses() is called again and now this snippet fails
for (clause = dyn->first_erased_cl; clause; clause = clause1)
 {
   clause1 = clause->next_erased_cl;
   size_of_erased -= clause->term_size;
   Unlink_Clause(clause);
   Free_Clause(clause);
 }
 
because clause->next_erased_cl might hold ALL_MUST_BE_ERASED instead of NULL, which is the stopping condition of that for loop.
 
Using GNU Prolog 1.4.4
 
Regards,
   Gustavo

--
Ce message a été vérifié par MailScanner pour des virus ou des polluriels et rien de suspect n'a été trouvé.

_______________________________________________
Bug-prolog mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-prolog


--
Ce message a été vérifié par MailScanner pour des virus ou des polluriels et rien de suspect n'a été trouvé.
_______________________________________________
Bug-prolog mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-prolog