Commit 4a65dc5
authored
Reject invalid non-null tokens beginning with n (#93)
* Add test cases for invalid n tokens
Tokens that begin with `n` should not be treated as `null`.
* Reject non-null tokens beginning with n
In 0f609dd, a regression was introduced
where the parser would read any token that started with n as null.
The `.type()` method returns `json_type::null` simply if the token
begins with `n`, and it does not check whether the token is actually
valid.
Adding an `is_null()` call here ensures this and returns an error if the
token starts with `n` but is not `null`. Calling `.value()` on the
returned value will raise it as an exception if `is_null()` returned an
error.
Currently with simdjson 3.10.1, there is a bug where calling `is_null`
on a document object lacks this behaviour, so currently this patch only
fixes the problem for non-scalar documents.
* Comment out broken tests for now1 parent 8e18887 commit 4a65dc5
6 files changed
Lines changed: 13 additions & 2 deletions
File tree
- jsonexamples/invalid
- spec
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
111 | 115 | | |
112 | 116 | | |
113 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
125 | 128 | | |
126 | 129 | | |
127 | 130 | | |
| |||
0 commit comments