Skip to content

Commit 9d7e14b

Browse files
Bypass bitwise NOT
1 parent 77fc7f7 commit 9d7e14b

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

LICENSE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023-2026 IP2Location
3+
Copyright (c) 2023 - 2026 IP2Location
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.
22-

docs/source/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
# -- Project information
77

88
project = 'IP2Location Lua'
9-
copyright = '2025, IP2Location'
9+
copyright = '2026, IP2Location'
1010
author = 'IP2Location'
1111

12-
release = '8.8.0'
13-
version = '8.8.0'
12+
release = '8.8.1'
13+
version = '8.8.1'
1414

1515
# -- General configuration
1616

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package = "ip2location"
2-
version = "8.8.0-1"
2+
version = "8.8.1-1"
33
source = {
44
url = "git://github.com/ip2location/ip2location-lua.git"
55
}

ip2location.lua

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ local asdomain_position = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
148148
local asusagetype_position = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27 }
149149
local ascidr_position = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28 }
150150

151-
local api_version = "8.8.0"
151+
local api_version = "8.8.1"
152152

153153
local modes = {
154154
countryshort = 0x0000001,
@@ -618,9 +618,8 @@ function ip2location:checkip(ip)
618618
ipnum = bn(ipnum2) -- convert back to bn
619619
elseif ipnum >= from_teredo and ipnum <= to_teredo then -- Teredo
620620
override = 1
621-
ipnum = ~ipnum
622-
ipnum2 = ipnum:asnumber() & 0xffffffff
623-
ipnum = bn(ipnum2) -- convert back to bn
621+
-- invert lower 32 bits only (bypass the bnot from the bn coz of weird error)
622+
ipnum = bn(0xffffffff) - (ipnum & bn(0xffffffff))
624623
end
625624

626625
local ipindex = 0

0 commit comments

Comments
 (0)