Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a issue may caused by attacked_text.py #693

Merged
merged 1 commit into from
Nov 1, 2022
Merged

Conversation

89x98
Copy link
Contributor

@89x98 89x98 commented Sep 8, 2022

Delete a repeat save parameters, it can lead to code in no response in some situation

Summary

Lines 404 and 474 of the code store the same parameters, so delete line 474.
If two identical parameters are saved at the same time, a long list of "prev_attacked_text" needs to be maintained internally when call get_transformations multiple times to generate transformed_texts. __eq__ function in AttackedText class is called repeatedly each time whether the transformed_texts exists in constraints_cache, and __eq__ function compares all parameters item by item. If comparing "prev_attacked_text" with "previous_ attacked_text" will enter the linked list saved by each other, sometimes the layers are very deep, the code can get stuck for a long time comparing them, eventually the code will not continue to run normally.

Deletions

  • delete code line 474
    new_attack_attrs["prev_attacked_text"] = self

Copy link
Collaborator

@jxmorris12 jxmorris12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@jxmorris12 jxmorris12 merged commit 5043fb6 into QData:master Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants