fix(read): prevent panic on negative slice index in a key path
GetValue and Exists validated only the upper bound of a numeric key-path segment, so a negative index such as "arr.-1" passed the check and indexed the slice with -1, causing an index-out-of-range panic. Add a lower-bound check (i < 0) to the []int, []string and []any cases in both functions.
This commit is contained in:
1 parent
d54d79012b
commit
cb6b9f9456
3 files changed
+29
-8
No files matched your search
Vendored
+2
-2
@@ -1,4 +1,4 @@
|
||||
; exported at 2025-08-20 14:11:56
|
||||
; exported at 2026-09-06 00:43:11
|
||||
|
||||
age = 123
|
||||
baseKey = value
|
||||
@@ -9,8 +9,8 @@ multiWords = hello world
|
||||
name = app
|
||||
|
||||
[map1]
|
||||
key = val
|
||||
key1 = val1
|
||||
key2 = val2
|
||||
key = val
|
||||
|
||||
|
||||
Reference in new issue
Block a user