Commit Graph

30 Commits

Author SHA1 Message Date
Masaaki Goshima e660ae468d Fix pointer alignment error 2021-03-29 02:44:49 +09:00
Masaaki Goshima e38c3606b3 Fix decoding of slice pointer type 2021-03-29 02:28:04 +09:00
Masaaki Goshima f8fd59516b Fix decoding of deep recursive structure 2021-02-18 19:05:06 +09:00
Masaaki Goshima 5351464001 Fix decoding of null value 2021-02-17 01:51:42 +09:00
Masaaki Goshima 98de7ff51b Fix error by linter 2021-02-09 22:20:23 +09:00
Masaaki Goshima 721f830cef Fix error handling of decoding of slice type 2021-02-09 22:19:13 +09:00
Masaaki Goshima 5227e49c39 Fix decoding of interface type 2021-02-09 21:37:18 +09:00
Masaaki Goshima a90f2cbf1b Refactor by linter 2021-02-03 23:50:02 +09:00
Masaaki Goshima 24aa07e47f Merge branch 'master' of github.com:goccy/go-json into feature/fix-decoder 2020-12-23 01:37:54 +09:00
Masaaki Goshima 4332d1353e Fix stream decoding 2020-12-05 22:27:33 +09:00
Masaaki Goshima 5c82b00ee7 Add structName and fieldName argument to each constructor of decoder for UnmarshalTypeError 2020-11-23 17:16:31 +09:00
Koichi Shiraishi 2b4097577d
Pass expression to unsafe.Pointer directly 2020-11-23 14:13:45 +09:00
Koichi Shiraishi e4214835d8
Fix checkptr validation error on decode 2020-11-23 06:47:57 +09:00
Masaaki Goshima fd7a72c0b8 Pass unsafe.Pointer instead of uintptr 2020-11-19 12:47:42 +09:00
Cuong Manh Le 6b1d701387
Fix all invalid usages of unsafe.Pointer
Most of the invalid usages due to the conversion from uintptr to
unsafe.Pointer. In general, unsafe.Pointer(p) where p of type uintptr is
considered unsafe.

To fix that, use &p instead of p, then introduce another dereference.
Example, the invalid usage:

	*(*int)(unsafe.Pointer(p)) = int(v)

wil become:

	**(**int)(unsafe.Pointer(&p)) = int(v)

Closes #53
2020-11-16 20:37:12 +07:00
Cuong Manh Le e58b1eabaf
Remove all usages of reflect.SliceHeader
There're some problem with current usage of reflect.SliceHeader.

First, it violates the unsafe pointer conversion (rule 6th), that said,
reflect.SliceHeader must not used as plain struct.

Second, the lowest version that go-json supports, go1.12, reflect
package did not use SliceHeader in typedslicecopy, but use the safety
version. There's no reason that go-json continue using them.

See:

 - https://golang.org/pkg/unsafe/#Pointer
 - https://github.com/golang/go/blob/release-branch.go1.12/src/reflect/value.go#L2702
2020-11-16 20:33:49 +07:00
Masaaki Goshima 27f6c70ab3 Fix DisallowUnknownFields 2020-08-14 17:59:49 +09:00
Masaaki Goshima ee13701278 Add Compact/Indent/HTMLEscape/Valid 2020-08-12 16:54:15 +09:00
Masaaki Goshima e112aa753e Support DisallowUnknownFields 2020-08-11 19:05:20 +09:00
Masaaki Goshima 69573d1b74 Fix null value for struct field 2020-08-08 13:20:42 +09:00
Masaaki Goshima c14253089e Fix stream decoder for slice 2020-07-31 18:52:22 +09:00
Masaaki Goshima daec57244d Merge branch 'master' of github.com:goccy/go-json into feature/support-stream-decoding 2020-07-31 18:46:54 +09:00
Masaaki Goshima 80acd42b80 Optimize streaming decoder 2020-07-31 17:10:03 +09:00
Masaaki Goshima 20b67ad48d Support Decoder.Token 2020-07-30 22:41:53 +09:00
Masaaki Goshima 48b2c82759 Fix a bug that crashes in parallel execution 2020-05-31 00:11:50 +09:00
Masaaki Goshima 4acc22e0fe Support SyntaxError 2020-05-23 12:51:09 +09:00
Masaaki Goshima bc23c32f1a Reuse slice instance for decoding 2020-05-07 21:30:36 +09:00
Masaaki Goshima f198ef6517 Remove context for decoding 2020-05-07 02:37:29 +09:00
Masaaki Goshima 9b1349d40a Fix decoder 2020-04-26 15:22:55 +09:00
Masaaki Goshima 71d6f845e5 Add decoder for Array or Slice type 2020-04-25 19:55:05 +09:00