svn commit: r1925645 - in /apr/apr-util/branches/1.7.x: ./ json/apr_json_decode.c

[email protected]
Newsgroups gmane.comp.apache.apr.cvs
Message-ID <[email protected]>
Author: ivan
Date: Sat May 17 15:34:06 2025
New Revision: 1925645

URL: http://svn.apache.org/viewvc?rev=1925645&view=rev
Log:
Merged r1902196, r1902207 from apr/trunk.

Modified:
    apr/apr-util/branches/1.7.x/   (props changed)
    apr/apr-util/branches/1.7.x/json/apr_json_decode.c

Propchange: apr/apr-util/branches/1.7.x/
------------------------------------------------------------------------------
  Merged /apr/apr/trunk:r1902196,1902207

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=1925645&r1=1925644&r2=1925645&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 Sat May 17 15:34:06 2025
@@ -353,7 +353,7 @@ static apr_status_t apr_json_decode_arra
         apr_json_value_t * array)
 {
     apr_status_t status = APR_SUCCESS;
-    apr_size_t count = 0;
+    int count = 0;
 
     if (self->p >= self->e) {
         return APR_EOF;
@@ -386,6 +386,10 @@ static apr_status_t apr_json_decode_arra
             break;
         }
 
+        if (count >= APR_INT32_MAX) {
+            return APR_ENOSPC;
+        }
+
         if (APR_SUCCESS != (status = apr_json_decode_value(self, &element))) {
             return status;
         }
@@ -394,7 +398,6 @@ static apr_status_t apr_json_decode_arra
                 != (status = apr_json_array_add(array, element))) {
             return status;
         }
-
         count++;
 
         if (self->p == self->e) {
@@ -412,7 +415,7 @@ static apr_status_t apr_json_decode_arra
     {
         apr_json_value_t *element = apr_json_array_first(array);
         array->value.array->array = apr_array_make(self->pool, count,
-                sizeof(apr_json_value_t *));
+                                                   sizeof(apr_json_value_t *));
         while (element) {
             *((apr_json_value_t **) (apr_array_push(array->value.array->array))) =
                     element;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.