Skip to content

Commit a4c9ddf

Browse files
authored
Fix UB in right shift (#10422)
1 parent 0025e00 commit a4c9ddf

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

ydb/library/yql/udfs/common/ip_base/lib/ip_base_udf.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ namespace {
9595
}
9696

9797
static TRawIp6 MaskFromPrefix(ui8 prefix) {
98-
ui128 x = ui128(-1) << int(128 - prefix);
99-
if (prefix == 0) x = 0;
98+
ui128 x = prefix == 0 ? ui128(0) : ui128(-1) << int(128 - prefix);
10099
return FromIpAddress({x, TIpv6Address::Ipv6});
101100
}
102101

0 commit comments

Comments
 (0)