Skip to content

[ZSvirt] bug: isIpv6RangeOverlap treats invalid ranges as overlapping #32

Description

@tllovesxs

Component

utils / network

Problem description

IPv6NetworkUtils.isIpv6RangeOverlap catches every exception from parsing/building the ranges and returns true.

Relevant code:
https://github.com/ZSvirt/zsvirt/blob/main/utils/src/main/java/org/zstack/utils/network/IPv6NetworkUtils.java#L202-L214

Malformed addresses and reversed ranges are therefore reported as overlapping. Callers use this predicate while validating or selecting networks, so invalid data can produce false conflict errors and mask the original input problem.

Steps to reproduce

Call IPv6NetworkUtils.isIpv6RangeOverlap with a malformed address or with a reversed range such as 2001:db8::10-2001:db8::2.

Expected behavior

Invalid input should not be reported as an overlap. The method should either reject invalid input consistently with the other validation helpers or return false after logging/validation.

Proposed fix

Validate the four addresses and return false for invalid/reversed ranges, or expose a throwing validation variant and keep the boolean predicate strict. Add regression tests for malformed and reversed ranges.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions