json_parse()/pgtypes: Fix accidental creation of read-only array/hash values
&PL_sv_* shouldn't be used when constructing arrays or hashes in this context.
This commit is contained in:
parent
817fa600d0
commit
d0c5397e2d
8 changed files with 45 additions and 11 deletions
|
|
@ -236,12 +236,12 @@ static SV *fujson_parse(pTHX_ fujson_parse_ctx *ctx) {
|
|||
if (ctx->end - ctx->buf < 4) return NULL;
|
||||
if (memcmp(ctx->buf, "true", 4) != 0) return NULL;
|
||||
ctx->buf += 4;
|
||||
return &PL_sv_yes;
|
||||
return newSV_true();
|
||||
case 'f':
|
||||
if (ctx->end - ctx->buf < 5) return NULL;
|
||||
if (memcmp(ctx->buf, "false", 5) != 0) return NULL;
|
||||
ctx->buf += 5;
|
||||
return &PL_sv_no;
|
||||
return newSV_false();
|
||||
case 'n':
|
||||
if (ctx->end - ctx->buf < 4) return NULL;
|
||||
if (memcmp(ctx->buf, "null", 4) != 0) return NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue