Skip to content

ArrayIndexOutOfBoundsException using IpAddressMatcher 7.1 #19329

@winfriedgerlach

Description

@winfriedgerlach

Describe the bug
We noticed that since release 7.1 (cc6a005 to be precise) an IpAddressMatcher for an IPv6 address will crash with ArrayIndexOutOfBoundsException when trying to match IPv4 address 0.0.0.0.

It is easy to fix this and return to the behavior before 7.1.

To Reproduce
very simple:

var matcher= new IpAddressMatcher("::1/128");
var result = machter.matches("0.0.0.0");
// java.lang.ArrayIndexOutOfBoundsException: Index 4 out of bounds for length 4

Expected behavior
No exception. Result should be false.

Sample

See above

I will submit a PR with regression test.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions