summaryrefslogtreecommitdiff
path: root/vendor/github.com/bytedance/sonic/unquote
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2023-06-01 22:20:16 +0100
committerLibravatar GitHub <noreply@github.com>2023-06-01 22:20:16 +0100
commit55aacaf4b07c1921061245cbaa3d307e97cf3c29 (patch)
treed969c5d9728566de1e794e19c5b19d3b660f790e /vendor/github.com/bytedance/sonic/unquote
parent[chore/frontend] refactor header templating, add apple-touch-icon (#1850) (diff)
downloadgotosocial-55aacaf4b07c1921061245cbaa3d307e97cf3c29.tar.xz
[chore]: Bump github.com/gin-gonic/gin from 1.9.0 to 1.9.1 (#1855)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/github.com/bytedance/sonic/unquote')
-rw-r--r--vendor/github.com/bytedance/sonic/unquote/unquote.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/vendor/github.com/bytedance/sonic/unquote/unquote.go b/vendor/github.com/bytedance/sonic/unquote/unquote.go
index 0ffdaac7d..23fca736e 100644
--- a/vendor/github.com/bytedance/sonic/unquote/unquote.go
+++ b/vendor/github.com/bytedance/sonic/unquote/unquote.go
@@ -18,6 +18,7 @@ package unquote
import (
`unsafe`
+ `runtime`
`github.com/bytedance/sonic/internal/native`
`github.com/bytedance/sonic/internal/native/types`
@@ -43,7 +44,8 @@ func intoBytesUnsafe(s string, m *[]byte) types.ParsingError {
pos := -1
slv := (*rt.GoSlice)(unsafe.Pointer(m))
str := (*rt.GoString)(unsafe.Pointer(&s))
- ret := native.Unquote(str.Ptr, str.Len, slv.Ptr, &pos, 0)
+ /* unquote as the default configuration, replace invalid unicode with \ufffd */
+ ret := native.Unquote(str.Ptr, str.Len, slv.Ptr, &pos, types.F_UNICODE_REPLACE)
/* check for errors */
if ret < 0 {
@@ -52,5 +54,6 @@ func intoBytesUnsafe(s string, m *[]byte) types.ParsingError {
/* update the length */
slv.Len = ret
+ runtime.KeepAlive(s)
return 0
}