Skip to content

[FIX] Avoid getting label by negative index #58

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

TropicalPenguin
Copy link

I've not diagnosed rhe root cause; hopefully this points to it though.

With a query, "MATCH (s)-[r:incs]-(l:EC) WHERE ID(s)=3 RETURN r,l", which should be retrieving:

127.0.0.1:6379> GRAPH.QUERY G:1 "MATCH (s)-[r:incs]-(l:EC) WHERE ID(s)=3 RETURN r,l"

    1. "r"
    2. "l"
          1. "id"
          2. (integer) 4
          1. "type"
          2. "incs"
          1. "src_node"
          2. (integer) 3
          1. "dest_node"
          2. (integer) 6
          1. "properties"
              1. "Net"
              2. "c4peu14uj9oqljf5dkn0"
          1. "id"
          2. (integer) 6
          1. "labels"
            1. "EC"
          1. "properties"
              1. "IDs"
              2. "[0, 4, 3]"

I instead get:

runtime error: index out of range [-2]
goroutine 210 [running]:
net/http.(*conn).serve.func1(0xc0002fc140)
/usr/lib/go-1.16/src/net/http/server.go:1824 +0x153
panic(0x9842e0, 0xc0014c04b0)
/usr/lib/go-1.16/src/runtime/panic.go:971 +0x499
github.com/redislabs/redisgraph-go.(*Graph).getLabel(0xc0018faea0, 0xfffffffffffffffe, 0x0, 0x0)
~/Dev/go/pkg/mod/github.com/redislabs/redisgraph-go@v2.0.2+incompatible/graph.go:141 +0x152
github.com/redislabs/redisgraph-go.(*QueryResult).parseNode(0xc0017e5e00, 0x908040, 0xc00081adf8, 0x0)
~/Dev/go/pkg/mod/github.com/redislabs/redisgraph-go@v2.0.2+incompatible/query_result.go:179 +0x219
github.com/redislabs/redisgraph-go.(*QueryResult).parseScalar(0xc0017e5e00, 0xc001461cc0, 0x2, 0x2, 0xc001461cc0, 0x2)
~/Dev/go/pkg/mod/github.com/redislabs/redisgraph-go@v2.0.2+incompatible/query_result.go:257 +0x2b7
github.com/redislabs/redisgraph-go.(*QueryResult).parseRecords(0xc0017e5e00, 0xc0017d2d80, 0x3, 0x3)
~/Dev/go/pkg/mod/github.com/redislabs/redisgraph-go@v2.0.2+incompatible/query_result.go:139 +0x434
github.com/redislabs/redisgraph-go.(*QueryResult).parseResults(0xc0017e5e00, 0xc0017d2d80, 0x3, 0x3)
~/Dev/go/pkg/mod/github.com/redislabs/redisgraph-go@v2.0.2+incompatible/query_result.go:99 +0x77
github.com/redislabs/redisgraph-go.QueryResultNew(0xc0018faea0, 0x908040, 0xc00081aea0, 0xc0017d2d20, 0x3, 0x3)
~/Dev/go/pkg/mod/github.com/redislabs/redisgraph-go@v2.0.2+incompatible/query_result.go:85 +0x1da
github.com/redislabs/redisgraph-go.(*Graph).Query(0xc0018faea0, 0xc0013cba80, 0x32, 0x7effa2628108, 0x40, 0xc0013cba80)
~/Dev/go/pkg/mod/github.com/redislabs/redisgraph-go@v2.0.2+incompatible/graph.go:108 +0x171

I've not diagnosed rhe root cause; hopefully this points to it though.

With a query, "MATCH (s)-[r:incs]-(l:EC) WHERE ID(s)=3 RETURN r,l", which should be retrieving:

127.0.0.1:6379> GRAPH.QUERY G:1 "MATCH (s)-[r:incs]-(l:EC) WHERE ID(s)=3 RETURN r,l"
1) 1) "r"
   2) "l"
2) 1) 1) 1) 1) "id"
            2) (integer) 4
         2) 1) "type"
            2) "incs"
         3) 1) "src_node"
            2) (integer) 3
         4) 1) "dest_node"
            2) (integer) 6
         5) 1) "properties"
            2) 1) 1) "Net"
                  2) "c4peu14uj9oqljf5dkn0"
      2) 1) 1) "id"
            2) (integer) 6
         2) 1) "labels"
            2) 1) "EC"
         3) 1) "properties"
            2) 1) 1) "IDs"
                  2) "[0, 4, 3]"

I instead get:

runtime error: index out of range [-2]
goroutine 210 [running]:
net/http.(*conn).serve.func1(0xc0002fc140)
	/usr/lib/go-1.16/src/net/http/server.go:1824 +0x153
panic(0x9842e0, 0xc0014c04b0)
	/usr/lib/go-1.16/src/runtime/panic.go:971 +0x499
github.com/redislabs/redisgraph-go.(*Graph).getLabel(0xc0018faea0, 0xfffffffffffffffe, 0x0, 0x0)
	~/Dev/go/pkg/mod/github.com/redislabs/redisgraph-go@v2.0.2+incompatible/graph.go:141 +0x152
github.com/redislabs/redisgraph-go.(*QueryResult).parseNode(0xc0017e5e00, 0x908040, 0xc00081adf8, 0x0)
	~/Dev/go/pkg/mod/github.com/redislabs/redisgraph-go@v2.0.2+incompatible/query_result.go:179 +0x219
github.com/redislabs/redisgraph-go.(*QueryResult).parseScalar(0xc0017e5e00, 0xc001461cc0, 0x2, 0x2, 0xc001461cc0, 0x2)
	~/Dev/go/pkg/mod/github.com/redislabs/redisgraph-go@v2.0.2+incompatible/query_result.go:257 +0x2b7
github.com/redislabs/redisgraph-go.(*QueryResult).parseRecords(0xc0017e5e00, 0xc0017d2d80, 0x3, 0x3)
	~/Dev/go/pkg/mod/github.com/redislabs/redisgraph-go@v2.0.2+incompatible/query_result.go:139 +0x434
github.com/redislabs/redisgraph-go.(*QueryResult).parseResults(0xc0017e5e00, 0xc0017d2d80, 0x3, 0x3)
	~/Dev/go/pkg/mod/github.com/redislabs/redisgraph-go@v2.0.2+incompatible/query_result.go:99 +0x77
github.com/redislabs/redisgraph-go.QueryResultNew(0xc0018faea0, 0x908040, 0xc00081aea0, 0xc0017d2d20, 0x3, 0x3)
	~/Dev/go/pkg/mod/github.com/redislabs/redisgraph-go@v2.0.2+incompatible/query_result.go:85 +0x1da
github.com/redislabs/redisgraph-go.(*Graph).Query(0xc0018faea0, 0xc0013cba80, 0x32, 0x7effa2628108, 0x40, 0xc0013cba80)
	~/Dev/go/pkg/mod/github.com/redislabs/redisgraph-go@v2.0.2+incompatible/graph.go:108 +0x171
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant