You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by mi...@apache.org on 2018/07/08 16:42:30 UTC
svn commit: r1835365 - /apr/apr-util/branches/1.7.x/json/apr_json_decode.c
Author: minfrin
Date: Sun Jul 8 16:42:30 2018
New Revision: 1835365
URL: http://svn.apache.org/viewvc?rev=1835365&view=rev
Log:
Backport r1835364.
Create the subpool after the failure cases are all considerd.
Modified:
apr/apr-util/branches/1.7.x/json/apr_json_decode.c
Modified: apr/apr-util/branches/1.7.x/json/apr_json_decode.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.7.x/json/apr_json_decode.c?rev=1835365&r1=1835364&r2=1835365&view=diff
==============================================================================
--- apr/apr-util/branches/1.7.x/json/apr_json_decode.c (original)
+++ apr/apr-util/branches/1.7.x/json/apr_json_decode.c Sun Jul 8 16:42:30 2018
@@ -354,18 +354,19 @@ static apr_status_t apr_json_decode_arra
json_link_t *head = NULL, *tail = NULL;
apr_size_t count = 0;
- if ((status = apr_pool_create(&link_pool, self->pool)))
- return status;
-
if (self->p >= self->e) {
status = APR_EOF;
goto out;
}
- self->level--;
- if (self->level < 0) {
+ if (self->level <= 0) {
return APR_EINVAL;
}
+ self->level--;
+
+ if ((status = apr_pool_create(&link_pool, self->pool))) {
+ return status;
+ }
self->p++; /* toss of the leading [ */
@@ -441,10 +442,10 @@ static apr_status_t apr_json_decode_obje
return APR_EOF;
}
- self->level--;
- if (self->level < 0) {
+ if (self->level <= 0) {
return APR_EINVAL;
}
+ self->level--;
self->p++; /* toss of the leading { */