Mercurial > prosody-hg
comparison util/jsonpointer.lua @ 12496:87c3d45208ef 0.12
util.jsonpointer: Fix off-by-one in array resolution
Fixes #1753
Not known to be used anywhere
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 08 May 2022 18:04:50 +0200 |
| parents | b4c0efff8dd3 |
| children | 03e307952816 |
comparison
equal
deleted
inserted
replaced
| 12495:5bf9056dca2c | 12496:87c3d45208ef |
|---|---|
| 18 elseif math.type(idx) == "integer" then | 18 elseif math.type(idx) == "integer" then |
| 19 local i = tonumber(token) | 19 local i = tonumber(token) |
| 20 if token == "-" then | 20 if token == "-" then |
| 21 i = #ref + 1 | 21 i = #ref + 1 |
| 22 end | 22 end |
| 23 new_ref = ref[i] | 23 new_ref = ref[i + 1] |
| 24 else | 24 else |
| 25 return nil, "invalid-table" | 25 return nil, "invalid-table" |
| 26 end | 26 end |
| 27 | 27 |
| 28 if pos == ptr_len then | 28 if pos == ptr_len then |
