Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime error: unsafe pointer arithmetic (Go 1.14 checkptr) #254

Closed
zikaeroh opened this issue Nov 8, 2019 · 4 comments · Fixed by #259 or zalando/skipper#1485
Closed

runtime error: unsafe pointer arithmetic (Go 1.14 checkptr) #254

zikaeroh opened this issue Nov 8, 2019 · 4 comments · Fixed by #259 or zalando/skipper#1485

Comments

@zikaeroh
Copy link
Contributor

zikaeroh commented Nov 8, 2019

Go 1.14 introduces new runtime pointer checking, enabled by default in race mode (golang/go#34964) which verify that the rules for using unsafe are followed.

Running the tests on this library with either -race or -gcflags=all=-d=checkptr=2 shows that this library has unsafe pointer operations. For example:

$ gotip test -gcflags=all=-d=checkptr=2 ./...
testing _glua-tests/base.lua
testing _glua-tests/coroutine.lua
testing _glua-tests/db.lua
testing _glua-tests/issues.lua
nil
testing _glua-tests/os.lua
date: invalid option -- 'a'
Try 'date --help' for more information.
testing _glua-tests/table.lua
testing _glua-tests/vm.lua
testing _glua-tests/math.lua
testing _glua-tests/strings.lua
testing _lua5.1-tests/attrib.lua
testing require

 >>> cannot load dynamic library <<<

nil	nil
+
testing assignments, logical operators, and constructors
+
testing _lua5.1-tests/calls.lua
testing functions and calls
testing _lua5.1-tests/closure.lua
testing closures and coroutines
testing _lua5.1-tests/constructs.lua
testing syntax
testing _lua5.1-tests/events.lua
testing metatables
testing _lua5.1-tests/literals.lua
testing scanner
+
+
+
+
+

 >>> pt_BR locale not available: skipping decimal point tests <<<

OK
testing _lua5.1-tests/locals.lua
testing local variables plus some extra stuff
testing _lua5.1-tests/math.lua
testing numbers and math lib
testing _lua5.1-tests/sort.lua
testing sort
testing _lua5.1-tests/strings.lua
testing strings and string library
+
+
+
testing _lua5.1-tests/vararg.lua
testing vararg
+
testing _lua5.1-tests/pm.lua
testing pattern matching
+
testing _lua5.1-tests/files.lua
+
--- FAIL: TestLua (0.17s)
    script_test.go:76: runtime error: unsafe pointer arithmetic
        goroutine 84 [running]:
        github.com/yuin/gopher-lua.(*LState).PCall.func1(0x613e98, 0xc000448210, 0xc000b37e18, 0x0, 0x0, 0x0)
        	/home/jake/repos/gopher-lua/state.go:1964 +0x5f1
        panic(0x5e4900, 0xc000b9ba20)
        	/home/jake/sdk/gotip/src/runtime/panic.go:961 +0x15d
        github.com/yuin/gopher-lua.(*allocator).LNumber2I(...)
        	/home/jake/repos/gopher-lua/alloc.go:71
        github.com/yuin/gopher-lua.(*registry).SetNumber(0xc0003ec280, 0x4, 0x40a7720000000000)
        	/home/jake/repos/gopher-lua/state.go:558 +0x168
        github.com/yuin/gopher-lua.init.3.func30(0xc000448210, 0xc08c0e0001, 0xc000aba000, 0x0)
        	/home/jake/repos/gopher-lua/vm.go:1204 +0xf4
        github.com/yuin/gopher-lua.mainLoop(0xc000448210, 0xc000aba000)
        	/home/jake/repos/gopher-lua/vm.go:31 +0xf0
        github.com/yuin/gopher-lua.(*LState).callR(0xc000448210, 0x0, 0xffffffffffffffff, 0x0)
        	/home/jake/repos/gopher-lua/state.go:1191 +0x248
        github.com/yuin/gopher-lua.(*LState).Call(...)
        	/home/jake/repos/gopher-lua/state.go:1943
        github.com/yuin/gopher-lua.(*LState).PCall(0xc000448210, 0x0, 0xffffffffffffffff, 0x0, 0x654300, 0xc000bc09c0)
        	/home/jake/repos/gopher-lua/state.go:2006 +0x114
        github.com/yuin/gopher-lua.(*LState).DoFile(0xc000448210, 0x607558, 0xa, 0xc000448210, 0xc00008eef8)
        	/home/jake/repos/gopher-lua/auxlib.go:394 +0xb8
        github.com/yuin/gopher-lua.testScriptDir(0xc0002d17a0, 0x7a1d20, 0xd, 0xd, 0x608139, 0xd)
        	/home/jake/repos/gopher-lua/script_test.go:75 +0x2f2
        github.com/yuin/gopher-lua.TestLua(0xc0002d17a0)
        	/home/jake/repos/gopher-lua/script_test.go:87 +0x64
        testing.tRunner(0xc0002d17a0, 0x613848)
        	/home/jake/sdk/gotip/src/testing/testing.go:954 +0xdc
        created by testing.(*T).Run
        	/home/jake/sdk/gotip/src/testing/testing.go:1005 +0x357
        
        stack traceback:
        	attrib.lua:304: in main chunk
        	[G]: ?
    script_test.go:76: runtime error: unsafe pointer arithmetic
        goroutine 84 [running]:
        github.com/yuin/gopher-lua.(*LState).PCall.func1(0x613e98, 0xc0004482c0, 0xc0009ade18, 0x0, 0x0, 0x0)
        	/home/jake/repos/gopher-lua/state.go:1964 +0x5f1
        panic(0x5e4900, 0xc000a2b280)
        	/home/jake/sdk/gotip/src/runtime/panic.go:961 +0x15d
        github.com/yuin/gopher-lua.(*allocator).LNumber2I(...)
        	/home/jake/repos/gopher-lua/alloc.go:71
        github.com/yuin/gopher-lua.(*registry).SetNumber(0xc0003ec410, 0x6, 0xc058800000000000)
        	/home/jake/repos/gopher-lua/state.go:558 +0x168
        github.com/yuin/gopher-lua.opArith(0xc0004482c0, 0xc03c0c0203, 0xc000974000, 0x0)
        	/home/jake/repos/gopher-lua/vm.go:1372 +0x21e
        github.com/yuin/gopher-lua.mainLoop(0xc0004482c0, 0xc000974000)
        	/home/jake/repos/gopher-lua/vm.go:31 +0xf0
        github.com/yuin/gopher-lua.(*LState).callR(0xc0004482c0, 0x0, 0xffffffffffffffff, 0x0)
        	/home/jake/repos/gopher-lua/state.go:1191 +0x248
        github.com/yuin/gopher-lua.(*LState).Call(...)
        	/home/jake/repos/gopher-lua/state.go:1943
        github.com/yuin/gopher-lua.(*LState).PCall(0xc0004482c0, 0x0, 0xffffffffffffffff, 0x0, 0x654300, 0xc000a9c180)
        	/home/jake/repos/gopher-lua/state.go:2006 +0x114
        github.com/yuin/gopher-lua.(*LState).DoFile(0xc0004482c0, 0x60706a, 0x9, 0xc0004482c0, 0xc000b37ef8)
        	/home/jake/repos/gopher-lua/auxlib.go:394 +0xb8
        github.com/yuin/gopher-lua.testScriptDir(0xc0002d17a0, 0x7a1d20, 0xd, 0xd, 0x608139, 0xd)
        	/home/jake/repos/gopher-lua/script_test.go:75 +0x2f2
        github.com/yuin/gopher-lua.TestLua(0xc0002d17a0)
        	/home/jake/repos/gopher-lua/script_test.go:87 +0x64
        testing.tRunner(0xc0002d17a0, 0x613848)
        	/home/jake/sdk/gotip/src/testing/testing.go:954 +0xdc
        created by testing.(*T).Run
        	/home/jake/sdk/gotip/src/testing/testing.go:1005 +0x357
        
        stack traceback:
        	calls.lua:38: in function 'x'
        	calls.lua:40: in main chunk
        	[G]: ?
    script_test.go:76: runtime error: unsafe pointer arithmetic
        goroutine 84 [running]:
        github.com/yuin/gopher-lua.(*LState).PCall.func1(0x613e98, 0xc000448580, 0xc00093fe18, 0x0, 0x0, 0x0)
        	/home/jake/repos/gopher-lua/state.go:1964 +0x5f1
        panic(0x5e4900, 0xc000a3f260)
        	/home/jake/sdk/gotip/src/runtime/panic.go:961 +0x15d
        github.com/yuin/gopher-lua.(*allocator).LNumber2I(...)
        	/home/jake/repos/gopher-lua/alloc.go:71
        github.com/yuin/gopher-lua.(*registry).SetNumber(0xc0003ec5a0, 0x8, 0x4026b0a3d70a3d71)
        	/home/jake/repos/gopher-lua/state.go:558 +0x168
        github.com/yuin/gopher-lua.opArith(0xc000448580, 0xc03c040401, 0xc000950000, 0x0)
        	/home/jake/repos/gopher-lua/vm.go:1372 +0x21e
        github.com/yuin/gopher-lua.mainLoop(0xc000448580, 0xc000950000)
        	/home/jake/repos/gopher-lua/vm.go:31 +0xf0
        github.com/yuin/gopher-lua.(*LState).callR(0xc000448580, 0x0, 0xffffffffffffffff, 0x0)
        	/home/jake/repos/gopher-lua/state.go:1191 +0x248
        github.com/yuin/gopher-lua.(*LState).Call(...)
        	/home/jake/repos/gopher-lua/state.go:1943
        github.com/yuin/gopher-lua.(*LState).PCall(0xc000448580, 0x0, 0xffffffffffffffff, 0x0, 0x654300, 0xc000aca880)
        	/home/jake/repos/gopher-lua/state.go:2006 +0x114
        github.com/yuin/gopher-lua.(*LState).DoFile(0xc000448580, 0x6079b8, 0xb, 0xc000448580, 0xc0009adef8)
        	/home/jake/repos/gopher-lua/auxlib.go:394 +0xb8
        github.com/yuin/gopher-lua.testScriptDir(0xc0002d17a0, 0x7a1d20, 0xd, 0xd, 0x608139, 0xd)
        	/home/jake/repos/gopher-lua/script_test.go:75 +0x2f2
        github.com/yuin/gopher-lua.TestLua(0xc0002d17a0)
        	/home/jake/repos/gopher-lua/script_test.go:87 +0x64
        testing.tRunner(0xc0002d17a0, 0x613848)
        	/home/jake/sdk/gotip/src/testing/testing.go:954 +0xdc
        created by testing.(*T).Run
        	/home/jake/sdk/gotip/src/testing/testing.go:1005 +0x357
        
        stack traceback:
        	closure.lua:126: in function <closure.lua:126>
        	closure.lua:132: in main chunk
        	[G]: ?
    script_test.go:76: runtime error: unsafe pointer arithmetic
        goroutine 84 [running]:
        github.com/yuin/gopher-lua.(*LState).PCall.func1(0x613e98, 0xc0004484d0, 0xc000349e18, 0x0, 0x0, 0x0)
        	/home/jake/repos/gopher-lua/state.go:1964 +0x5f1
        panic(0x5e4900, 0xc000b4ea80)
        	/home/jake/sdk/gotip/src/runtime/panic.go:961 +0x15d
        github.com/yuin/gopher-lua.(*allocator).LNumber2I(...)
        	/home/jake/repos/gopher-lua/alloc.go:71
        github.com/yuin/gopher-lua.(*registry).SetNumber(0xc0003ec4b0, 0x4, 0xbff0000000000000)
        	/home/jake/repos/gopher-lua/state.go:558 +0x168
        github.com/yuin/gopher-lua.init.3.func16(0xc0004484d0, 0xc0540c0003, 0xc000412000, 0x0)
        	/home/jake/repos/gopher-lua/vm.go:445 +0xb9
        github.com/yuin/gopher-lua.mainLoop(0xc0004484d0, 0xc000412000)
        	/home/jake/repos/gopher-lua/vm.go:31 +0xf0
        github.com/yuin/gopher-lua.(*LState).callR(0xc0004484d0, 0x0, 0xffffffffffffffff, 0x0)
        	/home/jake/repos/gopher-lua/state.go:1191 +0x248
        github.com/yuin/gopher-lua.(*LState).Call(...)
        	/home/jake/repos/gopher-lua/state.go:1943
        github.com/yuin/gopher-lua.(*LState).PCall(0xc0004484d0, 0x0, 0xffffffffffffffff, 0x0, 0x654300, 0xc00024f600)
        	/home/jake/repos/gopher-lua/state.go:2006 +0x114
        github.com/yuin/gopher-lua.(*LState).DoFile(0xc0004484d0, 0x60852e, 0xe, 0xc0004484d0, 0xc00093fef8)
        	/home/jake/repos/gopher-lua/auxlib.go:394 +0xb8
        github.com/yuin/gopher-lua.testScriptDir(0xc0002d17a0, 0x7a1d20, 0xd, 0xd, 0x608139, 0xd)
        	/home/jake/repos/gopher-lua/script_test.go:75 +0x2f2
        github.com/yuin/gopher-lua.TestLua(0xc0002d17a0)
        	/home/jake/repos/gopher-lua/script_test.go:87 +0x64
        testing.tRunner(0xc0002d17a0, 0x613848)
        	/home/jake/sdk/gotip/src/testing/testing.go:954 +0xdc
        created by testing.(*T).Run
        	/home/jake/sdk/gotip/src/testing/testing.go:1005 +0x357
        
        stack traceback:
        	constructs.lua:18: in main chunk
        	[G]: ?
    script_test.go:76: runtime error: unsafe pointer arithmetic
        goroutine 84 [running]:
        github.com/yuin/gopher-lua.(*LState).PCall.func1(0x613e98, 0xc0004480b0, 0xc0000dbe18, 0x0, 0x0, 0x0)
        	/home/jake/repos/gopher-lua/state.go:1964 +0x5f1
        panic(0x5e4900, 0xc00018e040)
        	/home/jake/sdk/gotip/src/runtime/panic.go:961 +0x15d
        github.com/yuin/gopher-lua.(*allocator).LNumber2I(...)
        	/home/jake/repos/gopher-lua/alloc.go:71
        github.com/yuin/gopher-lua.(*registry).SetNumber(0xc0003ec2d0, 0xc, 0x4068a00000000000)
        	/home/jake/repos/gopher-lua/state.go:558 +0x168
        github.com/yuin/gopher-lua.opArith(0xc0004480b0, 0xc0401a0202, 0xc00016e050, 0x0)
        	/home/jake/repos/gopher-lua/vm.go:1372 +0x21e
        github.com/yuin/gopher-lua.mainLoop(0xc0004480b0, 0xc00016e050)
        	/home/jake/repos/gopher-lua/vm.go:31 +0xf0
        github.com/yuin/gopher-lua.(*LState).callR(0xc0004480b0, 0x3, 0x0, 0x5)
        	/home/jake/repos/gopher-lua/state.go:1191 +0x248
        github.com/yuin/gopher-lua.(*LState).Call(...)
        	/home/jake/repos/gopher-lua/state.go:1943
        github.com/yuin/gopher-lua.(*LState).setField(0xc0004480b0, 0x657240, 0xc000224000, 0x657bc0, 0xc000092a28, 0x657bc0, 0xc000092a38)
        	/home/jake/repos/gopher-lua/state.go:1283 +0x1c6
        github.com/yuin/gopher-lua.init.3.func12(0xc0004480b0, 0xc02c024e02, 0xc00016e000, 0x0)
        	/home/jake/repos/gopher-lua/vm.go:392 +0x100
        github.com/yuin/gopher-lua.mainLoop(0xc0004480b0, 0xc00016e000)
        	/home/jake/repos/gopher-lua/vm.go:31 +0xf0
        github.com/yuin/gopher-lua.(*LState).callR(0xc0004480b0, 0x0, 0xffffffffffffffff, 0x0)
        	/home/jake/repos/gopher-lua/state.go:1191 +0x248
        github.com/yuin/gopher-lua.(*LState).Call(...)
        	/home/jake/repos/gopher-lua/state.go:1943
        github.com/yuin/gopher-lua.(*LState).PCall(0xc0004480b0, 0x0, 0xffffffffffffffff, 0x0, 0x654300, 0xc000b209c0)
        	/home/jake/repos/gopher-lua/state.go:2006 +0x114
        github.com/yuin/gopher-lua.(*LState).DoFile(0xc0004480b0, 0x607594, 0xa, 0xc0004480b0, 0xc000349ef8)
        	/home/jake/repos/gopher-lua/auxlib.go:394 +0xb8
        github.com/yuin/gopher-lua.testScriptDir(0xc0002d17a0, 0x7a1d20, 0xd, 0xd, 0x608139, 0xd)
        	/home/jake/repos/gopher-lua/script_test.go:75 +0x2f2
        github.com/yuin/gopher-lua.TestLua(0xc0002d17a0)
        	/home/jake/repos/gopher-lua/script_test.go:87 +0x64
        testing.tRunner(0xc0002d17a0, 0x613848)
        	/home/jake/sdk/gotip/src/testing/testing.go:954 +0xdc
        created by testing.(*T).Run
        	/home/jake/sdk/gotip/src/testing/testing.go:1005 +0x357
        
        stack traceback:
        	events.lua:50: in function <events.lua:50>
        	events.lua:52: in main chunk
        	[G]: ?
    script_test.go:76: runtime error: unsafe pointer arithmetic
        goroutine 84 [running]:
        github.com/yuin/gopher-lua.(*LState).PCall.func1(0x613e98, 0xc000448160, 0xc00010de18, 0x0, 0x0, 0x0)
        	/home/jake/repos/gopher-lua/state.go:1964 +0x5f1
        panic(0x5e4900, 0xc000c202e0)
        	/home/jake/sdk/gotip/src/runtime/panic.go:961 +0x15d
        github.com/yuin/gopher-lua.(*allocator).LNumber2I(...)
        	/home/jake/repos/gopher-lua/alloc.go:71
        github.com/yuin/gopher-lua.(*registry).SetNumber(0xc00027c140, 0xc, 0xc010000000000000)
        	/home/jake/repos/gopher-lua/state.go:558 +0x168
        github.com/yuin/gopher-lua.init.3.func30(0xc000448160, 0xc08c2e0023, 0xc0001e0000, 0x0)
        	/home/jake/repos/gopher-lua/vm.go:1204 +0xf4
        github.com/yuin/gopher-lua.mainLoop(0xc000448160, 0xc0001e0000)
        	/home/jake/repos/gopher-lua/vm.go:31 +0xf0
        github.com/yuin/gopher-lua.(*LState).callR(0xc000448160, 0x0, 0xffffffffffffffff, 0x0)
        	/home/jake/repos/gopher-lua/state.go:1191 +0x248
        github.com/yuin/gopher-lua.(*LState).Call(...)
        	/home/jake/repos/gopher-lua/state.go:1943
        github.com/yuin/gopher-lua.(*LState).PCall(0xc000448160, 0x0, 0xffffffffffffffff, 0x0, 0x654300, 0xc000b53900)
        	/home/jake/repos/gopher-lua/state.go:2006 +0x114
        github.com/yuin/gopher-lua.(*LState).DoFile(0xc000448160, 0x6075d0, 0xa, 0xc000448160, 0xc00010def8)
        	/home/jake/repos/gopher-lua/auxlib.go:394 +0xb8
        github.com/yuin/gopher-lua.testScriptDir(0xc0002d17a0, 0x7a1d20, 0xd, 0xd, 0x608139, 0xd)
        	/home/jake/repos/gopher-lua/script_test.go:75 +0x2f2
        github.com/yuin/gopher-lua.TestLua(0xc0002d17a0)
        	/home/jake/repos/gopher-lua/script_test.go:87 +0x64
        testing.tRunner(0xc0002d17a0, 0x613848)
        	/home/jake/sdk/gotip/src/testing/testing.go:954 +0xdc
        created by testing.(*T).Run
        	/home/jake/sdk/gotip/src/testing/testing.go:1005 +0x357
        
        stack traceback:
        	locals.lua:91: in main chunk
        	[G]: ?
    script_test.go:76: runtime error: unsafe pointer arithmetic
        goroutine 84 [running]:
        github.com/yuin/gopher-lua.(*LState).PCall.func1(0x613e98, 0xc000448000, 0xc000213e18, 0x0, 0x0, 0x0)
        	/home/jake/repos/gopher-lua/state.go:1964 +0x5f1
        panic(0x5e4900, 0xc0009c7bc0)
        	/home/jake/sdk/gotip/src/runtime/panic.go:961 +0x15d
        github.com/yuin/gopher-lua.(*allocator).LNumber2I(...)
        	/home/jake/repos/gopher-lua/alloc.go:71
        github.com/yuin/gopher-lua.(*registry).SetNumber(0xc00027c230, 0x4, 0xffefffffffffffff)
        	/home/jake/repos/gopher-lua/state.go:558 +0x168
        github.com/yuin/gopher-lua.init.3.func16(0xc000448000, 0xc0540c0003, 0xc0006ac000, 0x0)
        	/home/jake/repos/gopher-lua/vm.go:445 +0xb9
        github.com/yuin/gopher-lua.mainLoop(0xc000448000, 0xc0006ac000)
        	/home/jake/repos/gopher-lua/vm.go:31 +0xf0
        github.com/yuin/gopher-lua.(*LState).callR(0xc000448000, 0x0, 0xffffffffffffffff, 0x0)
        	/home/jake/repos/gopher-lua/state.go:1191 +0x248
        github.com/yuin/gopher-lua.(*LState).Call(...)
        	/home/jake/repos/gopher-lua/state.go:1943
        github.com/yuin/gopher-lua.(*LState).PCall(0xc000448000, 0x0, 0xffffffffffffffff, 0x0, 0x654300, 0xc0003642c0)
        	/home/jake/repos/gopher-lua/state.go:2006 +0x114
        github.com/yuin/gopher-lua.(*LState).DoFile(0xc000448000, 0x606cbf, 0x8, 0xc000448000, 0xc00010def8)
        	/home/jake/repos/gopher-lua/auxlib.go:394 +0xb8
        github.com/yuin/gopher-lua.testScriptDir(0xc0002d17a0, 0x7a1d20, 0xd, 0xd, 0x608139, 0xd)
        	/home/jake/repos/gopher-lua/script_test.go:75 +0x2f2
        github.com/yuin/gopher-lua.TestLua(0xc0002d17a0)
        	/home/jake/repos/gopher-lua/script_test.go:87 +0x64
        testing.tRunner(0xc0002d17a0, 0x613848)
        	/home/jake/sdk/gotip/src/testing/testing.go:954 +0xdc
        created by testing.(*T).Run
        	/home/jake/sdk/gotip/src/testing/testing.go:1005 +0x357
        
        stack traceback:
        	math.lua:16: in main chunk
        	[G]: ?
    script_test.go:76: runtime error: unsafe pointer arithmetic
        goroutine 84 [running]:
        github.com/yuin/gopher-lua.(*LState).PCall.func1(0x613e98, 0xc000448370, 0xc0000f9e18, 0x0, 0x0, 0x0)
        	/home/jake/repos/gopher-lua/state.go:1964 +0x5f1
        panic(0x5e4900, 0xc000581440)
        	/home/jake/sdk/gotip/src/runtime/panic.go:961 +0x15d
        github.com/yuin/gopher-lua.(*allocator).LNumber2I(...)
        	/home/jake/repos/gopher-lua/alloc.go:71
        github.com/yuin/gopher-lua.(*registry).SetNumber(0xc00027c280, 0x1, 0x4060000000000000)
        	/home/jake/repos/gopher-lua/state.go:558 +0x168
        github.com/yuin/gopher-lua.init.3.func29(0xc000448370, 0xc08801fff8, 0xc000166000, 0x0)
        	/home/jake/repos/gopher-lua/vm.go:1176 +0x15b
        github.com/yuin/gopher-lua.mainLoop(0xc000448370, 0xc000166000)
        	/home/jake/repos/gopher-lua/vm.go:31 +0xf0
        github.com/yuin/gopher-lua.(*LState).callR(0xc000448370, 0x0, 0xffffffffffffffff, 0x0)
        	/home/jake/repos/gopher-lua/state.go:1191 +0x248
        github.com/yuin/gopher-lua.(*LState).Call(...)
        	/home/jake/repos/gopher-lua/state.go:1943
        github.com/yuin/gopher-lua.(*LState).PCall(0xc000448370, 0x0, 0xffffffffffffffff, 0x0, 0x654300, 0xc0003b4580)
        	/home/jake/repos/gopher-lua/state.go:2006 +0x114
        github.com/yuin/gopher-lua.(*LState).DoFile(0xc000448370, 0x606d2f, 0x8, 0xc000448370, 0xc000213ef8)
        	/home/jake/repos/gopher-lua/auxlib.go:394 +0xb8
        github.com/yuin/gopher-lua.testScriptDir(0xc0002d17a0, 0x7a1d20, 0xd, 0xd, 0x608139, 0xd)
        	/home/jake/repos/gopher-lua/script_test.go:75 +0x2f2
        github.com/yuin/gopher-lua.TestLua(0xc0002d17a0)
        	/home/jake/repos/gopher-lua/script_test.go:87 +0x64
        testing.tRunner(0xc0002d17a0, 0x613848)
        	/home/jake/sdk/gotip/src/testing/testing.go:954 +0xdc
        created by testing.(*T).Run
        	/home/jake/sdk/gotip/src/testing/testing.go:1005 +0x357
        
        stack traceback:
        	sort.lua:21: in main chunk
        	[G]: ?
    script_test.go:76: runtime error: unsafe pointer arithmetic
        goroutine 84 [running]:
        github.com/yuin/gopher-lua.(*LState).PCall.func1(0x613e98, 0xc000448420, 0xc0000f9e18, 0x0, 0x0, 0x0)
        	/home/jake/repos/gopher-lua/state.go:1964 +0x5f1
        panic(0x5e4900, 0xc00018efc0)
        	/home/jake/sdk/gotip/src/runtime/panic.go:961 +0x15d
        github.com/yuin/gopher-lua.(*allocator).LNumber2I(...)
        	/home/jake/repos/gopher-lua/alloc.go:71
        github.com/yuin/gopher-lua.(*registry).SetNumber(0xc00027c370, 0x1, 0xbff0000000000000)
        	/home/jake/repos/gopher-lua/state.go:558 +0x168
        github.com/yuin/gopher-lua.init.3.func30(0xc000448420, 0xc08c02000d, 0xc000150000, 0x0)
        	/home/jake/repos/gopher-lua/vm.go:1204 +0xf4
        github.com/yuin/gopher-lua.mainLoop(0xc000448420, 0xc000150000)
        	/home/jake/repos/gopher-lua/vm.go:31 +0xf0
        github.com/yuin/gopher-lua.(*LState).callR(0xc000448420, 0x0, 0xffffffffffffffff, 0x0)
        	/home/jake/repos/gopher-lua/state.go:1191 +0x248
        github.com/yuin/gopher-lua.(*LState).Call(...)
        	/home/jake/repos/gopher-lua/state.go:1943
        github.com/yuin/gopher-lua.(*LState).PCall(0xc000448420, 0x0, 0xffffffffffffffff, 0x0, 0x654300, 0xc0001bd100)
        	/home/jake/repos/gopher-lua/state.go:2006 +0x114
        github.com/yuin/gopher-lua.(*LState).DoFile(0xc000448420, 0x607af7, 0xb, 0xc000448420, 0xc0000f9ef8)
        	/home/jake/repos/gopher-lua/auxlib.go:394 +0xb8
        github.com/yuin/gopher-lua.testScriptDir(0xc0002d17a0, 0x7a1d20, 0xd, 0xd, 0x608139, 0xd)
        	/home/jake/repos/gopher-lua/script_test.go:75 +0x2f2
        github.com/yuin/gopher-lua.TestLua(0xc0002d17a0)
        	/home/jake/repos/gopher-lua/script_test.go:87 +0x64
        testing.tRunner(0xc0002d17a0, 0x613848)
        	/home/jake/sdk/gotip/src/testing/testing.go:954 +0xdc
        created by testing.(*T).Run
        	/home/jake/sdk/gotip/src/testing/testing.go:1005 +0x357
        
        stack traceback:
        	strings.lua:88: in main chunk
        	[G]: ?
    script_test.go:76: runtime error: unsafe pointer arithmetic
        goroutine 84 [running]:
        github.com/yuin/gopher-lua.(*LState).PCall.func1(0x613e98, 0xc0004486e0, 0xc0000f9e18, 0x0, 0x0, 0x0)
        	/home/jake/repos/gopher-lua/state.go:1964 +0x5f1
        panic(0x5e4900, 0xc0002c8c60)
        	/home/jake/sdk/gotip/src/runtime/panic.go:961 +0x15d
        github.com/yuin/gopher-lua.(*allocator).LNumber2I(...)
        	/home/jake/repos/gopher-lua/alloc.go:71
        github.com/yuin/gopher-lua.(*registry).SetNumber(0xc00027ca00, 0x6, 0x3ff4cccccccccccd)
        	/home/jake/repos/gopher-lua/state.go:558 +0x168
        github.com/yuin/gopher-lua.opArith(0xc0004486e0, 0xc03c163202, 0xc000412000, 0x0)
        	/home/jake/repos/gopher-lua/vm.go:1372 +0x21e
        github.com/yuin/gopher-lua.mainLoop(0xc0004486e0, 0xc000412000)
        	/home/jake/repos/gopher-lua/vm.go:31 +0xf0
        github.com/yuin/gopher-lua.(*LState).callR(0xc0004486e0, 0x0, 0xffffffffffffffff, 0x0)
        	/home/jake/repos/gopher-lua/state.go:1191 +0x248
        github.com/yuin/gopher-lua.(*LState).Call(...)
        	/home/jake/repos/gopher-lua/state.go:1943
        github.com/yuin/gopher-lua.(*LState).PCall(0xc0004486e0, 0x0, 0xffffffffffffffff, 0x0, 0x654300, 0xc000bf6200)
        	/home/jake/repos/gopher-lua/state.go:2006 +0x114
        github.com/yuin/gopher-lua.(*LState).DoFile(0xc0004486e0, 0x6076ac, 0xa, 0xc0004486e0, 0xc0000f9ef8)
        	/home/jake/repos/gopher-lua/auxlib.go:394 +0xb8
        github.com/yuin/gopher-lua.testScriptDir(0xc0002d17a0, 0x7a1d20, 0xd, 0xd, 0x608139, 0xd)
        	/home/jake/repos/gopher-lua/script_test.go:75 +0x2f2
        github.com/yuin/gopher-lua.TestLua(0xc0002d17a0)
        	/home/jake/repos/gopher-lua/script_test.go:87 +0x64
        testing.tRunner(0xc0002d17a0, 0x613848)
        	/home/jake/sdk/gotip/src/testing/testing.go:954 +0xdc
        created by testing.(*T).Run
        	/home/jake/sdk/gotip/src/testing/testing.go:1005 +0x357
        
        stack traceback:
        	vararg.lua:53: in main chunk
        	[G]: ?
    script_test.go:76: runtime error: unsafe pointer arithmetic
        goroutine 84 [running]:
        github.com/yuin/gopher-lua.(*LState).PCall.func1(0x613e98, 0xc000448210, 0xc000885e18, 0x0, 0x0, 0x0)
        	/home/jake/repos/gopher-lua/state.go:1964 +0x5f1
        panic(0x5e4900, 0xc000923b80)
        	/home/jake/sdk/gotip/src/runtime/panic.go:961 +0x15d
        github.com/yuin/gopher-lua.(*allocator).LNumber2I(...)
        	/home/jake/repos/gopher-lua/alloc.go:71
        github.com/yuin/gopher-lua.(*registry).SetNumber(0xc00027c550, 0x8, 0xbff0000000000000)
        	/home/jake/repos/gopher-lua/state.go:558 +0x168
        github.com/yuin/gopher-lua.init.3.func30(0xc000448210, 0xc08c0e0004, 0xc000928000, 0x0)
        	/home/jake/repos/gopher-lua/vm.go:1204 +0xf4
        github.com/yuin/gopher-lua.mainLoop(0xc000448210, 0xc000928000)
        	/home/jake/repos/gopher-lua/vm.go:31 +0xf0
        github.com/yuin/gopher-lua.(*LState).callR(0xc000448210, 0x0, 0xffffffffffffffff, 0x0)
        	/home/jake/repos/gopher-lua/state.go:1191 +0x248
        github.com/yuin/gopher-lua.(*LState).Call(...)
        	/home/jake/repos/gopher-lua/state.go:1943
        github.com/yuin/gopher-lua.(*LState).PCall(0xc000448210, 0x0, 0xffffffffffffffff, 0x0, 0x654300, 0xc000341580)
        	/home/jake/repos/gopher-lua/state.go:2006 +0x114
        github.com/yuin/gopher-lua.(*LState).DoFile(0xc000448210, 0x606532, 0x6, 0xc000448210, 0xc0000f9ef8)
        	/home/jake/repos/gopher-lua/auxlib.go:394 +0xb8
        github.com/yuin/gopher-lua.testScriptDir(0xc0002d17a0, 0x7a1d20, 0xd, 0xd, 0x608139, 0xd)
        	/home/jake/repos/gopher-lua/script_test.go:75 +0x2f2
        github.com/yuin/gopher-lua.TestLua(0xc0002d17a0)
        	/home/jake/repos/gopher-lua/script_test.go:87 +0x64
        testing.tRunner(0xc0002d17a0, 0x613848)
        	/home/jake/sdk/gotip/src/testing/testing.go:954 +0xdc
        created by testing.(*T).Run
        	/home/jake/sdk/gotip/src/testing/testing.go:1005 +0x357
        
        stack traceback:
        	pm.lua:89: in function 'range'
        	pm.lua:93: in main chunk
        	[G]: ?
    script_test.go:76: runtime error: unsafe pointer arithmetic
        goroutine 84 [running]:
        github.com/yuin/gopher-lua.(*LState).PCall.func1(0x613e98, 0xc0004482c0, 0xc000847e18, 0x0, 0x0, 0x0)
        	/home/jake/repos/gopher-lua/state.go:1964 +0x5f1
        panic(0x5e4900, 0xc0009ca4c0)
        	/home/jake/sdk/gotip/src/runtime/panic.go:961 +0x15d
        github.com/yuin/gopher-lua.(*allocator).LNumber2I(...)
        	/home/jake/repos/gopher-lua/alloc.go:71
        github.com/yuin/gopher-lua.(*registry).SetNumber(0xc0003ec0f0, 0xb, 0xc026000000000000)
        	/home/jake/repos/gopher-lua/state.go:558 +0x168
        github.com/yuin/gopher-lua.init.3.func16(0xc0004482c0, 0xc05428000a, 0xc000a06000, 0x0)
        	/home/jake/repos/gopher-lua/vm.go:445 +0xb9
        github.com/yuin/gopher-lua.mainLoop(0xc0004482c0, 0xc000a06000)
        	/home/jake/repos/gopher-lua/vm.go:31 +0xf0
        github.com/yuin/gopher-lua.(*LState).callR(0xc0004482c0, 0x0, 0xffffffffffffffff, 0x0)
        	/home/jake/repos/gopher-lua/state.go:1191 +0x248
        github.com/yuin/gopher-lua.(*LState).Call(...)
        	/home/jake/repos/gopher-lua/state.go:1943
        github.com/yuin/gopher-lua.(*LState).PCall(0xc0004482c0, 0x0, 0xffffffffffffffff, 0x0, 0x654300, 0xc00041bb80)
        	/home/jake/repos/gopher-lua/state.go:2006 +0x114
        github.com/yuin/gopher-lua.(*LState).DoFile(0xc0004482c0, 0x6070a9, 0x9, 0xc0004482c0, 0xc000885ef8)
        	/home/jake/repos/gopher-lua/auxlib.go:394 +0xb8
        github.com/yuin/gopher-lua.testScriptDir(0xc0002d17a0, 0x7a1d20, 0xd, 0xd, 0x608139, 0xd)
        	/home/jake/repos/gopher-lua/script_test.go:75 +0x2f2
        github.com/yuin/gopher-lua.TestLua(0xc0002d17a0)
        	/home/jake/repos/gopher-lua/script_test.go:87 +0x64
        testing.tRunner(0xc0002d17a0, 0x613848)
        	/home/jake/sdk/gotip/src/testing/testing.go:954 +0xdc
        created by testing.(*T).Run
        	/home/jake/sdk/gotip/src/testing/testing.go:1005 +0x357
        
        stack traceback:
        	files.lua:94: in main chunk
        	[G]: ?
-------------------------
thread: 0xc000448840
top: 6
function base: 5
return base: 5
local base: 6
0 function: 0xc0008467c0
1 function: 0xc000846800
2 function: 0xc000846840
3 function: 0xc000846840
4 function: 0xc000838300
5 function: 0xc000838400
-------------------------

-------------------------
thread: 0xc000aac000
top: 6
function base: 5
return base: 5
local base: 6
0 function: 0xc000846b00
1 function: 0xc000846b40
2 function: 0xc000846b80
3 function: 0xc000846b80
4 function: 0xc000ab2800
5 function: 0xc000ab2300
-------------------------


--- FAIL: TestContextTimeout (0.00s)
    testutils_test.go:27: state_test.go:389: execution must be canceled
--- FAIL: TestContextCancel (1.00s)
    testutils_test.go:27: state_test.go:416: execution must be canceled
FAIL
FAIL	github.com/yuin/gopher-lua	5.257s
?   	github.com/yuin/gopher-lua/ast	[no test files]
?   	github.com/yuin/gopher-lua/cmd/glua	[no test files]
?   	github.com/yuin/gopher-lua/parse	[no test files]
?   	github.com/yuin/gopher-lua/pm	[no test files]
FAIL

You'll want to investigate these bad operations, not only because 1.14 will make tests and users break in race mode, but because these operations represent real potential bugs.

Forgive me for dropping the template, but I didn't think it fit.

@mdempsky
Copy link

The bad conversion in question is here:

fptr := (*float64)(unsafe.Pointer(al.fheader.Data + uintptr(len(al.fptrs)-1)*unsafe.Sizeof(_fv)))

The problem is that al.fheader.Data needs to be converted to unsafe.Pointer before being converted back to uintptr for pointer arithmetic.

But more generally, I don't understand why this code is using reflect.SliceHeader in the first place. The above line can be rewritten simply as:

fptr := &al.fptrs[len(al.fptrs)-1]

@zikaeroh
Copy link
Contributor Author

@mdempsky Am I right in assuming that switching checkptr to throw() rather than panic() would make these tests show the bad operation with a trace / pointer info, rather than being caught and eaten by a recover? When I saw these checks, I didn't immediately realize that they were checkptr but something else until I remembered that checkptr's current implementation is a panic.

@mdempsky
Copy link

@zikaeroh Yeah, if checkptr used throw(), then the process would immediately terminate at the bad conversion instead.

@zikaeroh
Copy link
Contributor Author

zikaeroh commented Dec 5, 2019

I was going to submit a PR with the simple change given above, but it appears as though this repo doesn't pass its tests race mode anyway. Test output: https://gist.github.com/zikaeroh/f94c7ee185720e39b632c00f8994527f

I can still submit the one-line change (as it at least will likely fix my own test failures as a user of probably a limited set of features), but tests here should also be run in race mode.

@yuin yuin closed this as completed in #259 Dec 13, 2019
howardjohn added a commit to howardjohn/istio that referenced this issue Apr 7, 2020
The library had an unsafe pointer usage that breaks go1.14:
yuin/gopher-lua#254

For istio#21567

 I have verified this locally
istio-testing pushed a commit to istio/istio that referenced this issue Apr 9, 2020
* Update gopher-lua library

The library had an unsafe pointer usage that breaks go1.14:
yuin/gopher-lua#254

For #21567

 I have verified this locally

* Add licenses

* fix license

* fix license
AlexanderYastrebov added a commit to AlexanderYastrebov/skipper that referenced this issue Jul 11, 2020
* Updates gopher-lua dependency to fix [checkptr: unsafe pointer arithmetic](yuin/gopher-lua#254)
* Adds context path_param projection as table
* Adds request url_query projection as table
* Adds request url_path getter and setter
* Adds response status_code getter and setter
* Implements header, path_param and url_query iteration
* Headers and url query return nil on missing key
* Passes indexed script params along with key-values
* Uses proper log module
* Makes 'print' builtin write into log
* Uses lua's RaiseError for error handling
* Returns less results instead of pushing lua.LNil
* Updates documentation

See script_test.go for usage examples.

Signed-off-by: Alexander Yastrebov <[email protected]>
AlexanderYastrebov added a commit to AlexanderYastrebov/skipper that referenced this issue Jul 11, 2020
* Updates gopher-lua dependency to fix [checkptr: unsafe pointer arithmetic](yuin/gopher-lua#254)
* Adds context path_param projection as table
* Adds request url_query projection as table
* Adds request url_path getter and setter
* Adds response status_code getter and setter
* Implements header, path_param and url_query iteration
* Headers and url query return nil on missing key
* Passes indexed script params along with key-values
* Uses proper log module
* Makes 'print' builtin write into log
* Uses lua's RaiseError for error handling
* Returns less results instead of pushing lua.LNil
* Updates documentation

See script_test.go for usage examples.

Signed-off-by: Alexander Yastrebov <[email protected]>
AlexanderYastrebov added a commit to AlexanderYastrebov/skipper that referenced this issue Jul 11, 2020
* Updates gopher-lua dependency to fix [checkptr: unsafe pointer arithmetic](yuin/gopher-lua#254)
* Adds context path_param projection as table
* Adds request url_query projection as table
* Adds request url_path getter and setter
* Adds response status_code getter and setter
* Implements header, path_param and url_query iteration
* Headers and url query return nil on missing key
* Passes indexed script params along with key-values
* Uses proper log module
* Makes 'print' builtin write into log
* Uses lua's RaiseError for error handling
* Returns less results instead of pushing lua.LNil
* Updates documentation and tests

See script_test.go for usage examples.

Signed-off-by: Alexander Yastrebov <[email protected]>
AlexanderYastrebov added a commit to AlexanderYastrebov/skipper that referenced this issue Jul 11, 2020
* Updates gopher-lua dependency to fix [checkptr: unsafe pointer arithmetic](yuin/gopher-lua#254)
* Adds context path_param projection as table
* Adds request url_query projection as table
* Adds request url_path getter and setter
* Adds response status_code getter and setter
* Implements header, path_param and url_query iteration
* Headers and url query return nil on missing key
* Passes indexed script params along with key-values
* Uses proper log module
* Makes 'print' builtin write into log
* Uses lua's RaiseError for error handling
* Returns less results instead of pushing lua.LNil
* Updates documentation and tests

See script_test.go for usage examples.

Signed-off-by: Alexander Yastrebov <[email protected]>
AlexanderYastrebov added a commit to AlexanderYastrebov/skipper that referenced this issue Jul 11, 2020
* Updates gopher-lua dependency to fix [checkptr: unsafe pointer arithmetic](yuin/gopher-lua#254)
* Adds context path_param projection as table
* Adds request url_query projection as table
* Adds request url_path getter and setter
* Adds response status_code getter and setter
* Implements header, path_param and url_query iteration
* Headers and url query return nil on missing key
* Passes indexed script params along with key-values
* Uses proper log module
* Makes 'print' builtin write into log
* Uses lua's RaiseError for error handling
* Returns less results instead of pushing lua.LNil
* Updates documentation and tests

See script_test.go for usage examples.

Signed-off-by: Alexander Yastrebov <[email protected]>
AlexanderYastrebov added a commit to AlexanderYastrebov/skipper that referenced this issue Jul 11, 2020
* Updates gopher-lua dependency to fix [checkptr: unsafe pointer arithmetic](yuin/gopher-lua#254)
* Adds context path_param projection as table
* Adds request url_query projection as table
* Adds request url_path getter and setter
* Adds response status_code getter and setter
* Implements header, path_param and url_query iteration
* Headers and url query return nil on missing key
* Passes indexed script params along with key-values
* Uses proper log module
* Makes 'print' builtin write into log
* Uses lua's RaiseError for error handling
* Returns less results instead of pushing lua.LNil
* Updates documentation and tests

See script_test.go for usage examples.

Signed-off-by: Alexander Yastrebov <[email protected]>
AlexanderYastrebov added a commit to AlexanderYastrebov/skipper that referenced this issue Jul 11, 2020
* Updates gopher-lua dependency to fix [checkptr: unsafe pointer arithmetic](yuin/gopher-lua#254)
* Adds context path_param projection as table
* Adds request url_query projection as table
* Adds request url_raw_query getter and setter
* Adds request url_path getter and setter
* Adds response status_code getter and setter
* Implements header, path_param and url_query iteration
* Headers and url query return nil on missing key
* Passes indexed script params along with key-values
* Uses proper log module
* Makes 'print' builtin write into log
* Uses lua's RaiseError for error handling
* Returns less results instead of pushing lua.LNil
* Updates documentation and tests

See script_test.go for usage examples.

Signed-off-by: Alexander Yastrebov <[email protected]>
AlexanderYastrebov added a commit to AlexanderYastrebov/skipper that referenced this issue Jul 11, 2020
* Updates gopher-lua dependency to fix [checkptr: unsafe pointer arithmetic](yuin/gopher-lua#254)
* Adds context path_param projection as table
* Adds request url_query projection as table
* Adds request url_raw_query getter and setter
* Adds request url_path getter and setter
* Adds response status_code getter and setter
* Implements header and url_query iteration
* Headers and url query return nil on missing key
* Passes indexed script params along with key-values
* Uses proper log module
* Makes 'print' builtin write into log
* Uses lua's RaiseError for error handling
* Returns less results instead of pushing lua.LNil
* Updates documentation and tests

See script_test.go for usage examples.

Signed-off-by: Alexander Yastrebov <[email protected]>
AlexanderYastrebov added a commit to AlexanderYastrebov/skipper that referenced this issue Jul 11, 2020
* Updates gopher-lua dependency to fix [checkptr: unsafe pointer arithmetic](yuin/gopher-lua#254)
* Adds context path_param projection as table
* Adds request url_query projection as table
* Adds request url_raw_query getter and setter
* Adds request url_path getter and setter
* Adds response status_code getter and setter
* Implements header and url_query iteration
* Headers and url query return nil on missing key
* Passes indexed script params along with key-values
* Uses proper log module
* Makes 'print' builtin write into log
* Uses lua's RaiseError for error handling
* Returns less results instead of pushing lua.LNil
* Updates documentation and tests

See script_test.go for usage examples.

Signed-off-by: Alexander Yastrebov <[email protected]>
AlexanderYastrebov added a commit to AlexanderYastrebov/skipper that referenced this issue Jul 12, 2020
* Updates gopher-lua dependency to fix [checkptr: unsafe pointer arithmetic](yuin/gopher-lua#254)
* Adds context path_param projection as table
* Adds request url_query projection as table
* Adds request url_raw_query getter and setter
* Adds request url_path getter and setter
* Adds response status_code getter and setter
* Implements header and url_query iteration
* Headers and url query return nil on missing key
* Passes indexed script params along with key-values
* Uses proper log module
* Makes 'print' builtin write into log
* Uses lua's RaiseError for error handling
* Returns less results instead of pushing lua.LNil
* Updates documentation and tests

See script_test.go for usage examples.

Signed-off-by: Alexander Yastrebov <[email protected]>
AlexanderYastrebov added a commit to AlexanderYastrebov/skipper that referenced this issue Jul 12, 2020
* Updates gopher-lua dependency to fix [checkptr: unsafe pointer arithmetic](yuin/gopher-lua#254)
* Adds context path_param projection as table
* Adds request url_query projection as table
* Adds request url_raw_query getter and setter
* Adds request url_path getter and setter
* Adds response status_code getter and setter
* Implements header and url_query iteration
* Headers and url query return nil on missing key
* Passes indexed script params along with key-values
* Uses proper log module
* Makes 'print' builtin write into log
* Uses lua's RaiseError for error handling
* Returns less results instead of pushing lua.LNil
* Updates documentation and tests

See script_test.go for usage examples.

Signed-off-by: Alexander Yastrebov <[email protected]>
AlexanderYastrebov added a commit to AlexanderYastrebov/skipper that referenced this issue Jul 12, 2020
* Updates gopher-lua dependency to fix [checkptr: unsafe pointer arithmetic](yuin/gopher-lua#254)
* Adds context path_param projection as table
* Adds request url_query projection as table
* Adds request url_raw_query getter and setter
* Adds request url_path getter and setter
* Adds response status_code getter and setter
* Implements header and url_query iteration
* Headers and url query return nil on missing key
* Passes indexed script params along with key-values
* Uses proper log module
* Makes 'print' builtin write into log
* Uses lua's RaiseError for error handling
* Returns less results instead of pushing lua.LNil
* Updates documentation and tests

See script_test.go for usage examples.

Signed-off-by: Alexander Yastrebov <[email protected]>
AlexanderYastrebov added a commit to AlexanderYastrebov/skipper that referenced this issue Jul 13, 2020
* Updates gopher-lua dependency to fix [checkptr: unsafe pointer arithmetic](yuin/gopher-lua#254)
* Adds context path_param projection as table
* Adds request url_query projection as table
* Adds request url_raw_query getter and setter
* Adds request url_path getter and setter
* Adds response status_code getter and setter
* Implements header and url_query iteration
* Headers and url query return nil on missing key
* Passes indexed script params along with key-values
* Uses proper log module
* Makes 'print' builtin write into log
* Uses lua's RaiseError for error handling
* Returns less results instead of pushing lua.LNil
* Updates documentation and tests

See script_test.go for usage examples.

Signed-off-by: Alexander Yastrebov <[email protected]>
AlexanderYastrebov added a commit to AlexanderYastrebov/skipper that referenced this issue Jul 13, 2020
* Updates gopher-lua dependency to fix [checkptr: unsafe pointer arithmetic](yuin/gopher-lua#254)
* Adds context path_param projection as table
* Adds request url_query projection as table
* Adds request url_raw_query getter and setter
* Adds request url_path getter and setter
* Adds response status_code getter and setter
* Implements header and url_query iteration
* Headers and url query return nil on missing key
* Passes indexed script params along with key-values
* Uses proper log module
* Makes 'print' builtin write into log
* Uses lua's RaiseError for error handling
* Returns less results instead of pushing lua.LNil
* Updates documentation and tests

See script_test.go for usage examples.

Signed-off-by: Alexander Yastrebov <[email protected]>
AlexanderYastrebov added a commit to AlexanderYastrebov/skipper that referenced this issue Jul 14, 2020
* Updates gopher-lua dependency to fix [checkptr: unsafe pointer arithmetic](yuin/gopher-lua#254)
* Adds context path_param projection as table
* Adds request url_query projection as table
* Adds request url_raw_query getter and setter
* Adds request url_path getter and setter
* Adds response status_code getter and setter
* Implements header and url_query iteration
* Headers and url query return nil on missing key
* Passes indexed script params along with key-values
* Uses proper log module
* Makes 'print' builtin write into log
* Uses lua's RaiseError for error handling
* Returns less results instead of pushing lua.LNil
* Updates documentation and tests

See script_test.go for usage examples.

Signed-off-by: Alexander Yastrebov <[email protected]>
AlexanderYastrebov added a commit to AlexanderYastrebov/skipper that referenced this issue Jul 14, 2020
* Updates gopher-lua dependency to fix [checkptr: unsafe pointer arithmetic](yuin/gopher-lua#254)
* Adds context path_param projection as table
* Adds request url_query projection as table
* Adds request url_raw_query getter and setter
* Adds request url_path getter and setter
* Adds response status_code getter and setter
* Implements header and url_query iteration
* Headers and url query return nil on missing key
* Passes indexed script params along with key-values
* Uses proper log module
* Makes 'print' builtin write into log
* Uses lua's RaiseError for error handling
* Returns less results instead of pushing lua.LNil
* Updates documentation and tests

See script_test.go for usage examples.

Signed-off-by: Alexander Yastrebov <[email protected]>
AlexanderYastrebov added a commit to AlexanderYastrebov/skipper that referenced this issue Jul 14, 2020
* Updates gopher-lua dependency to fix [checkptr: unsafe pointer arithmetic](yuin/gopher-lua#254)
* Adds context path_param projection as table
* Adds request url_query projection as table
* Adds request url_raw_query getter and setter
* Adds request url_path getter and setter
* Adds response status_code getter and setter
* Implements header and url_query iteration
* Headers and url query return nil on missing key
* Passes indexed script params along with key-values
* Uses proper log module
* Makes 'print' builtin write into log
* Uses lua's RaiseError for error handling
* Returns less results instead of pushing lua.LNil
* Updates documentation and tests

See script_test.go for usage examples.

Signed-off-by: Alexander Yastrebov <[email protected]>
AlexanderYastrebov added a commit to AlexanderYastrebov/skipper that referenced this issue Jul 14, 2020
* Updates gopher-lua dependency to fix [checkptr: unsafe pointer arithmetic](yuin/gopher-lua#254)
* Adds context path_param projection as table
* Adds request url_query projection as table
* Adds request url_raw_query getter and setter
* Adds request url_path getter and setter
* Adds response status_code getter and setter
* Implements header and url_query iteration
* Headers and url query return nil on missing key
* Passes indexed script params along with key-values
* Uses proper log module
* Makes 'print' builtin write into log
* Uses lua's RaiseError for error handling
* Returns less results instead of pushing lua.LNil
* Updates documentation and tests

See script_test.go for usage examples.

Signed-off-by: Alexander Yastrebov <[email protected]>
AlexanderYastrebov added a commit to AlexanderYastrebov/skipper that referenced this issue Jul 14, 2020
* Updates gopher-lua dependency to fix [checkptr: unsafe pointer arithmetic](yuin/gopher-lua#254)
* Adds context path_param projection as table
* Adds request url_query projection as table
* Adds request url_raw_query getter and setter
* Adds request url_path getter and setter
* Adds response status_code getter and setter
* Implements header and url_query iteration
* Headers and url query return nil on missing key
* Passes indexed script params along with key-values
* Uses proper log module
* Makes 'print' builtin write into log
* Uses lua's RaiseError for error handling
* Returns less results instead of pushing lua.LNil
* Updates documentation and tests

See script_test.go for usage examples.

Signed-off-by: Alexander Yastrebov <[email protected]>
AlexanderYastrebov added a commit to AlexanderYastrebov/skipper that referenced this issue Jul 14, 2020
* Updates gopher-lua dependency to fix [checkptr: unsafe pointer arithmetic](yuin/gopher-lua#254)
* Adds context path_param projection as table
* Adds request url_query projection as table
* Adds request url_raw_query getter and setter
* Adds request url_path getter and setter
* Adds response status_code getter and setter
* Implements header and url_query iteration
* Headers and url query return nil on missing key
* Passes indexed script params along with key-values
* Uses proper log module
* Makes 'print' builtin write into log
* Uses lua's RaiseError for error handling
* Returns less results instead of pushing lua.LNil
* Updates documentation and tests

See script_test.go for usage examples.

Signed-off-by: Alexander Yastrebov <[email protected]>
AlexanderYastrebov added a commit to AlexanderYastrebov/skipper that referenced this issue Jul 14, 2020
* Updates gopher-lua dependency to fix [checkptr: unsafe pointer arithmetic](yuin/gopher-lua#254)
* Adds context path_param projection as table
* Adds request url_query projection as table
* Adds request url_raw_query getter and setter
* Adds request url_path getter and setter
* Adds response status_code getter and setter
* Implements header and url_query iteration
* Headers and url query return nil on missing key
* Passes indexed script params along with key-values
* Uses proper log module
* Makes 'print' builtin write into log
* Uses lua's RaiseError for error handling
* Returns less results instead of pushing lua.LNil
* Updates documentation and tests

See script_test.go for usage examples.

Signed-off-by: Alexander Yastrebov <[email protected]>
AlexanderYastrebov added a commit to AlexanderYastrebov/skipper that referenced this issue Jul 14, 2020
* Updates gopher-lua dependency to fix [checkptr: unsafe pointer arithmetic](yuin/gopher-lua#254)
* Adds context path_param projection as table
* Adds request url_query projection as table
* Adds request url_raw_query getter and setter
* Adds request url_path getter and setter
* Adds response status_code getter and setter
* Implements header and url_query iteration
* Headers and url query return nil on missing key
* Passes indexed script params along with key-values
* Uses proper log module
* Makes 'print' builtin write into log
* Uses lua's RaiseError for error handling
* Returns less results instead of pushing lua.LNil
* Updates documentation and tests

See script_test.go for usage examples.

Signed-off-by: Alexander Yastrebov <[email protected]>
AlexanderYastrebov added a commit to AlexanderYastrebov/skipper that referenced this issue Jul 14, 2020
* Updates gopher-lua dependency to fix [checkptr: unsafe pointer arithmetic](yuin/gopher-lua#254)
* Adds context path_param projection as table
* Adds request url_query projection as table
* Adds request url_raw_query getter and setter
* Adds request url_path getter and setter
* Adds response status_code getter and setter
* Implements header and url_query iteration
* Passes indexed script params along with key-values
* Uses proper log module
* Makes 'print' builtin write into log
* Uses lua's RaiseError for error handling
* Returns less results instead of pushing lua.LNil
* Updates documentation and tests

See script_test.go for usage examples.

Signed-off-by: Alexander Yastrebov <[email protected]>
AlexanderYastrebov added a commit to AlexanderYastrebov/skipper that referenced this issue Jul 16, 2020
* Updates gopher-lua dependency to fix [checkptr: unsafe pointer arithmetic](yuin/gopher-lua#254)
* Adds context path_param projection as table
* Adds request url_query projection as table
* Adds request url_raw_query getter and setter
* Adds request url_path getter and setter
* Adds response status_code getter and setter
* Implements header and url_query iteration
* Passes indexed script params along with key-values
* Uses proper log module
* Makes 'print' builtin write into log
* Uses lua's RaiseError for error handling
* Returns less results instead of pushing lua.LNil
* Updates documentation and tests

See script_test.go for usage examples.

Signed-off-by: Alexander Yastrebov <[email protected]>
szuecs pushed a commit to zalando/skipper that referenced this issue Jul 16, 2020
* Updates gopher-lua dependency to fix [checkptr: unsafe pointer arithmetic](yuin/gopher-lua#254)
* Adds context path_param projection as table
* Adds request url_query projection as table
* Adds request url_raw_query getter and setter
* Adds request url_path getter and setter
* Adds response status_code getter and setter
* Implements header and url_query iteration
* Passes indexed script params along with key-values
* Uses proper log module
* Makes 'print' builtin write into log
* Uses lua's RaiseError for error handling
* Returns less results instead of pushing lua.LNil
* Updates documentation and tests

See script_test.go for usage examples.

Signed-off-by: Alexander Yastrebov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants