On Sun, Jul 8, 2018 at 1:26 PM,  <minf...@apache.org> wrote:
> Author: minfrin
> Date: Sun Jul  8 11:26:00 2018
> New Revision: 1835348
[]
> Added:
[]
>     apr/apr/trunk/json/apr_json.c   (with props)
[]
> +
> +static apr_status_t apr_json_decode_string(apr_json_scanner_t * self, 
> apr_json_string_t * retval)
> +{
> +    apr_status_t status = APR_SUCCESS;
> +    apr_json_string_t string;
> +    const char *p = self->p;
> +    const char *e;
> +    char *q;
> +
> +    if (self->p >= self->e) {
> +        status = APR_EOF;
> +        goto out;
> +    }
> +
> +    self->p++; /* eat the leading '"' */
> +
> +    /* advance past the \ " */
> +    string.len = 0;
> +    for (p = self->p, e = self->e; p < e;) {
> +        if (*p == '"')
> +            break;
> +        else if (*p == '\\') {
> +            p++;
> +            if (p >= e) {
> +                status = APR_EOF;
> +                goto out;
> +            }
> +            if (*p == 'u') {
> +                if (p + 4 >= e) {
> +                    status = APR_EOF;
> +                    goto out;
> +                }
> +                p += 5;
> +                string.len += 4;/* an UTF-8 character spans at most 4 bytes 
> */
> +                break;

Why break here and ignore potential/subsequent '\u....' encodings in
the same json string?

> +            }
> +            else {
> +                string.len++;
> +                p++;
> +            }
> +        }
> +        else {
> +            string.len++;
> +            p++;
> +        }
> +    }
> +
> +    string.p = q = apr_pcalloc(self->pool, string.len + 1);
> +    e = p;

(below this anything from 'e', thus after the first '\u....', seems to
be ignored)


Regards,
Yann.

Reply via email to