File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed
main/java/org/elasticsearch/index/mapper
test/java/org/elasticsearch/index/mapper Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change
1
+ pr : 112872
2
+ summary : Fix parsing error in `_terms_enum` API
3
+ area : Search
4
+ type : bug
5
+ issues :
6
+ - 94378
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ private static Automaton getIpv6Automaton(String ipPrefix) {
108
108
} else {
109
109
// potentially partial block
110
110
if (groupsAdded == 0 && ONLY_ZEROS .matcher (group ).matches ()) {
111
- // here we have a leading group with only "0" characters. If we would allow this to match
111
+ // here we have a leading group with only "0" characters. If we allowed this to match
112
112
// ipv6 addresses, this would include things like 0000::127.0.0.1 (and all other ipv4 addresses).
113
113
// Allowing this would be counterintuitive, so "0*" prefixes should only expand
114
114
// to ipv4 addresses like "0.1.2.3" and we return with an automaton not matching anything here
@@ -129,7 +129,7 @@ private static Automaton getIpv6Automaton(String ipPrefix) {
129
129
130
130
static Automaton automatonFromIPv6Group (String ipv6Group ) {
131
131
assert ipv6Group .length () > 0 && ipv6Group .length () <= 4 : "expected a full ipv6 group or prefix" ;
132
- Automaton result = Automata .makeString ( "" );
132
+ Automaton result = Automata .makeEmpty ( );
133
133
for (int leadingZeros = 0 ; leadingZeros <= 4 - ipv6Group .length (); leadingZeros ++) {
134
134
int bytesAdded = 0 ;
135
135
String padded = padWithZeros (ipv6Group , leadingZeros );
Original file line number Diff line number Diff line change @@ -174,6 +174,12 @@ public void testBuildPrefixAutomaton() throws UnknownHostException {
174
174
assertTrue (accepts (a , "255.27.240.24" ));
175
175
assertTrue (accepts (a , "255:a360::25bb:828f:ffff:ffff" ));
176
176
}
177
+ {
178
+ CompiledAutomaton a = buildIpPrefixAutomaton ("23c9::" );
179
+ assertTrue (accepts (a , "23c9::6063:7ac9:ffff:ffff" ));
180
+ assertFalse (accepts (a , "0.0.0.0" ));
181
+ assertFalse (accepts (a , "249.43.32.175" ));
182
+ }
177
183
}
178
184
179
185
private static boolean accepts (CompiledAutomaton compiledAutomaton , String address ) throws UnknownHostException {
You can’t perform that action at this time.
0 commit comments