vendor: github.com/valyala/fastjson v1.6.7
- pool.go: add missing Arena.Reset() call inside ArenaPool.Put() - Treat nil values as null in SetArrayItem prevents a potential panic when a nil value is used as an array item full diff: https://github.com/valyala/fastjson/compare/v1.6.4...v1.6.7 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
+4
-4
@@ -8,10 +8,10 @@ import (
|
||||
//
|
||||
// Typical Arena lifecycle:
|
||||
//
|
||||
// 1) Construct Values via the Arena and Value.Set* calls.
|
||||
// 2) Marshal the constructed Values with Value.MarshalTo call.
|
||||
// 3) Reset all the constructed Values at once by Arena.Reset call.
|
||||
// 4) Go to 1 and re-use the Arena.
|
||||
// 1. Construct Values via the Arena and Value.Set* calls.
|
||||
// 2. Marshal the constructed Values with Value.MarshalTo call.
|
||||
// 3. Reset all the constructed Values at once by Arena.Reset call.
|
||||
// 4. Go to 1 and re-use the Arena.
|
||||
//
|
||||
// It is unsafe calling Arena methods from concurrent goroutines.
|
||||
// Use per-goroutine Arenas or ArenaPool instead.
|
||||
|
||||
-1
@@ -4,6 +4,5 @@ Package fastjson provides fast JSON parsing.
|
||||
Arbitrary JSON may be parsed by fastjson without the need for creating structs
|
||||
or for generating go code. Just parse JSON and get the required fields with
|
||||
Get* functions.
|
||||
|
||||
*/
|
||||
package fastjson
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
//go:build gofuzz
|
||||
// +build gofuzz
|
||||
|
||||
package fastjson
|
||||
|
||||
+1
@@ -48,5 +48,6 @@ func (ap *ArenaPool) Get() *Arena {
|
||||
//
|
||||
// a and objects created by a cannot be used after a is put into ap.
|
||||
func (ap *ArenaPool) Put(a *Arena) {
|
||||
a.Reset()
|
||||
ap.pool.Put(a)
|
||||
}
|
||||
|
||||
+3
@@ -106,5 +106,8 @@ func (v *Value) SetArrayItem(idx int, value *Value) {
|
||||
for idx >= len(v.a) {
|
||||
v.a = append(v.a, valueNull)
|
||||
}
|
||||
if value == nil {
|
||||
value = valueNull
|
||||
}
|
||||
v.a[idx] = value
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user