Changeset

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 12495:5bf9056dca2c
children 12497:83f269db6850 12499:03e307952816
files teal-src/util/jsonpointer.tl util/jsonpointer.lua
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/teal-src/util/jsonpointer.tl	Sun May 08 18:03:44 2022 +0200
+++ b/teal-src/util/jsonpointer.tl	Sun May 08 18:04:50 2022 +0200
@@ -24,7 +24,7 @@
 		elseif idx is integer then
 			local i = tonumber(token)
 			if token == "-" then i = #ref + 1 end
-			new_ref = ref[i]
+			new_ref = ref[i+1]
 		else
 			return nil, "invalid-table"
 		end
--- a/util/jsonpointer.lua	Sun May 08 18:03:44 2022 +0200
+++ b/util/jsonpointer.lua	Sun May 08 18:04:50 2022 +0200
@@ -20,7 +20,7 @@
 			if token == "-" then
 				i = #ref + 1
 			end
-			new_ref = ref[i]
+			new_ref = ref[i + 1]
 		else
 			return nil, "invalid-table"
 		end