Skip to content

TO_IP leading_zeros=octal causes invalid IP Address behavior #141627

@strawgate

Description

@strawgate

Elasticsearch Version

latest

Installed Plugins

No response

Java Version

bundled

OS Version

serverless

Problem Description

In ParseIp.java, the leadingZerosAreOctal() function is missing the bounds check if (v > 255) { throw invalid(string); } that exists in both leadingZerosRejected() (line 105) and leadingZerosAreDecimal() (line 151).

Before

Steps to Reproduce

ROW 
  input = "192.400.168.1"
| EVAL octal = TO_IP(input, {"leading_zeros":"octal"})
| EVAL decimal = TO_IP(input, {"leading_zeros":"decimal"})
| EVAL reject = TO_IP(input, {"leading_zeros":"reject"})

Produces:

reject = null
decimal = null
octal = 192.144.168.1

Logs (if relevant)

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions