Jim Tcl
Check-in [453a61f142]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:jsmn: Fix a parser bug where object keys could be non-strings

Signed-off-by: Steve Bennett <steveb@workware.net.au>

Timelines: family | ancestors | descendants | both | trunk |
Files: files | file ages | folders
SHA1: 453a61f14299eb557430c028bc40253c84f4b474
User & Date: steveb@workware.net.au 2019-11-09 09:59:14
Context
2019-11-09
09:59
json: Add json encoder/decoder

Using the jsmn library for decoding. Based on the original implementation by Svyatoslav Mishyn <juef@openmailbox.org>

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 39428d770b user: steveb@workware.net.au tags: trunk,

09:59
jsmn: Fix a parser bug where object keys could be non-strings

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 453a61f142 user: steveb@workware.net.au tags: trunk,

09:59
jsmn: import json decoder

This will be used to add json decode support

From: https://github.com/zserge/jsmn, v1.0.0

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 29b649e8ae user: steveb@workware.net.au tags: trunk,

Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to jsmn/jsmn.c.

166
167
168
169
170
171
172




173
174
175
176
177
178
179
				if (tokens == NULL) {
					break;
				}
				token = jsmn_alloc_token(parser, tokens, num_tokens);
				if (token == NULL)
					return JSMN_ERROR_NOMEM;
				if (parser->toksuper != -1) {




					tokens[parser->toksuper].size++;
#ifdef JSMN_PARENT_LINKS
					token->parent = parser->toksuper;
#endif
				}
				token->type = (c == '{' ? JSMN_OBJECT : JSMN_ARRAY);
				token->start = parser->pos;







>
>
>
>







166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
				if (tokens == NULL) {
					break;
				}
				token = jsmn_alloc_token(parser, tokens, num_tokens);
				if (token == NULL)
					return JSMN_ERROR_NOMEM;
				if (parser->toksuper != -1) {
					if (tokens[parser->toksuper].type == JSMN_OBJECT) {
						/* Object keys must be strings, not objects or arrays */
						return JSMN_ERROR_INVAL;
					}
					tokens[parser->toksuper].size++;
#ifdef JSMN_PARENT_LINKS
					token->parent = parser->toksuper;
#endif
				}
				token->type = (c == '{' ? JSMN_OBJECT : JSMN_ARRAY);
				token->start = parser->pos;