Skip to content

(ec2-alpha): rangesOverlap utility function is wrong #32145

@nick-kang

Description

@nick-kang

Describe the bug

rangesOverlap uses string comparison to determine overlap, which I believe is incorrect.

// example
rangesOverlap(
  ["10.0.0.0", "10.0.15.255"], // 10.0.0.0/20 
  ["10.0.128.0", "10.0.143.255"] // 10.0.128.0/20
)

The above example should return false, but it returns true. Double checked some online tool to confirm that the cidrs do not actually overlap (https://cidrclash.com/clash-results).

image

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

No response

Expected Behavior

rangesOverlap implements proper cidr comparison

Current Behavior

Implementation is incorrect

Reproduction Steps

See description

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.167.0-alpha.0

Framework Version

No response

Node.js Version

22

OS

MacOS

Language

TypeScript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-lambdaRelated to AWS LambdabugThis issue is a bug.effort/smallSmall work item – less than a day of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions