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

1.1.1 version breaks Resolv gem IPv4 #61

Closed
lorrocha opened this issue Feb 15, 2023 · 1 comment · Fixed by #70
Closed

1.1.1 version breaks Resolv gem IPv4 #61

lorrocha opened this issue Feb 15, 2023 · 1 comment · Fixed by #70

Comments

@lorrocha
Copy link

The monkeypatch for the Resolv gem is actually breaking the regex class for IPv4.

https://github.com/ruby/resolv/blob/993a1a374fcb2a91b9d26a2215ddbb116db43788/lib/resolv.rb#L2349

As far as I can tell, it's due to the code found here:

        if (0..255) === (a = $1.to_i) &&
           (0..255) === (b = $2.to_i) &&
           (0..255) === (c = $3.to_i) &&
           (0..255) === (d = $4.to_i)

It expects global variables $1 to $4 to be set, with values matching each of the ipv4 groups. The overriding === method does not set these global variables in the monkey patched implementation, so one ends up with an IPv4 object with address 0.0.0.0, because the globals are nil and nil.to_i is 0.

An example of an IPv4 dns that breaks is: Resolv.getname('167.89.116.35')

This works before the Resolv patch is applied, but breaks once Resolve has been patched.

@arkadiyt
Copy link
Owner

arkadiyt commented Sep 1, 2023

@lorrocha sorry on the very long delay here, this should be fixed on main and I'll be doing a release soon

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 a pull request may close this issue.

2 participants