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: Don't loop forever if an RR CLASS doesn't match the apex CLASS. #457

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/sign/records.rs
Original file line number Diff line number Diff line change
Expand Up @@ -492,11 +492,10 @@ impl<'a, N, D> RecordsIter<'a, N, D> {
where
N: ToName,
{
while let Some(first) = self.slice.first() {
if first.class() != apex.class() {
continue;
}
if apex == first || first.owner().ends_with(apex.owner()) {
for rr in self.slice {
Copy link
Member

Choose a reason for hiding this comment

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

For-looping on a thing that you are also currently modifying sounds scary and unintuitive. I’m kind of surprised the compiler lets you do this.

Copy link
Member

Choose a reason for hiding this comment

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

In my opinion, signing needs to be changed to not allow multiple classes. There is no need to that feature and it just make the code more complex.

if rr.class() == apex.class()
&& (apex == rr || rr.owner().ends_with(apex.owner()))
{
break;
}
self.slice = &self.slice[1..]
Expand Down