apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From minf...@apache.org
Subject svn commit: r1835365 - /apr/apr-util/branches/1.7.x/json/apr_json_decode.c
Date Sun, 08 Jul 2018 16:42:30 GMT
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 { */
 



Mime
View raw message