Conversation
Contributor
|
Workflow [PR], commit [201870a] Summary: ❌
|
Member
Author
|
(Also tested it exhaustively with a throwaway program: https://pastila.nl/?00341389/481302c8be36778056a08a913fe30b35#3WESTWRfajr0rKdSkl8dsA== , doesn't seem worthwhile to polish it into a proper gtest.) |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical bug in the IPv4 parsing implementation where invalid inputs could return garbage values due to hash collisions in the SSE-optimized parser. The fix adds validation to ensure the detected pattern matches the actual input structure before proceeding with parsing.
Key changes:
- Added dotmask validation to prevent hash collision false positives
- Extended pattern table to include expected dotmask for collision detection
- Added test cases covering the problematic invalid inputs
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/Common/formatIPv6.cpp |
Core fix: Expanded pattern table from 16 to 18 bytes per entry to include dotmask validation data, and added collision detection check before pattern matching |
tests/queries/0_stateless/03727_ipv4_parsing_bug.sql |
Test queries for invalid IPv4 strings that previously returned garbage |
tests/queries/0_stateless/03727_ipv4_parsing_bug.reference |
Expected output showing all invalid inputs now correctly return 0.0.0.0 |
Avogar
approved these changes
Nov 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed IPv4 parsing functions (e.g.
IPv4StringToNumOrDefault) returning garbage for some invalid inputs. Resolves #90544. Resolves #87583Details
Closes #90544