| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - /* auto-generated on 2026-05-06 17:28:39 -0400. version 4.6.4 Do not edit! */ | ||
| 1 | + /* auto-generated on 2026-07-30 16:20:13 -0400. version 4.6.6 Do not edit! */ | ||
| 2 | 2 | /* including simdjson.cpp: */ | |
| 3 | 3 | /* begin file simdjson.cpp */ | |
| 4 | 4 | #define SIMDJSON_SRC_SIMDJSON_CPP | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - /* auto-generated on 2026-05-06 17:28:39 -0400. version 4.6.4 Do not edit! */ | ||
| 1 | + /* auto-generated on 2026-07-30 16:20:13 -0400. version 4.6.6 Do not edit! */ | ||
| 2 | 2 | /* including simdjson.h: */ | |
| 3 | 3 | /* begin file simdjson.h */ | |
| 4 | 4 | #ifndef SIMDJSON_H | |
@@ -2538,7 +2538,7 @@ namespace std { | |||
| 2538 | 2538 | #define SIMDJSON_SIMDJSON_VERSION_H | |
| 2539 | 2539 | ||
| 2540 | 2540 | /** The version of simdjson being used (major.minor.revision) */ | |
| 2541 | - #define SIMDJSON_VERSION "4.6.4" | ||
| 2541 | + #define SIMDJSON_VERSION "4.6.6" | ||
| 2542 | 2542 | ||
| 2543 | 2543 | namespace simdjson { | |
| 2544 | 2544 | enum { | |
@@ -2553,7 +2553,7 @@ enum { | |||
| 2553 | 2553 | /** | |
| 2554 | 2554 | * The revision (major.minor.REVISION) of simdjson being used. | |
| 2555 | 2555 | */ | |
| 2556 | - SIMDJSON_VERSION_REVISION = 4 | ||
| 2556 | + SIMDJSON_VERSION_REVISION = 6 | ||
| 2557 | 2557 | }; | |
| 2558 | 2558 | } // namespace simdjson | |
| 2559 | 2559 | ||
@@ -8067,16 +8067,28 @@ inline std::pair<std::string_view, std::string_view> get_next_key_and_json_path( | |||
| 8067 | 8067 | } | |
| 8068 | 8068 | ||
| 8069 | 8069 | key = json_path.substr(key_start, i - key_start); | |
| 8070 | - } else if ((i+1 < json_path.size()) && json_path[i] == '[' && (json_path[i+1] == '\'' || json_path[i+1] == '"')) { | ||
| 8070 | + } else if ((i + 1 < json_path.size()) && json_path[i] == '[' && | ||
| 8071 | + (json_path[i + 1] == '\'' || json_path[i + 1] == '"')) { | ||
| 8072 | + // Bracket-quoted key: ['key'] or ["key"]. | ||
| 8073 | + // Require a matching closing quote and a following ']'. If either is | ||
| 8074 | + // missing, return an empty key and the original path so callers can treat | ||
| 8075 | + // this as a parse failure (e.g. INVALID_JSON_POINTER) without advancing. | ||
| 8076 | + // Without this check, i += 2 can make i > size() and substr throws | ||
| 8077 | + // std::out_of_range, which aborts noexcept callers such as | ||
| 8078 | + // at_path_with_wildcard / for_each_at_path_with_wildcard. | ||
| 8079 | + const char quote = json_path[i + 1]; | ||
| 8071 | 8080 | i += 2; | |
| 8072 | - size_t key_start = i; | ||
| 8073 | - while (i < json_path.length() && json_path[i] != '\'' && json_path[i] != '"') { | ||
| 8081 | + const size_t key_start = i; | ||
| 8082 | + while (i < json_path.length() && json_path[i] != quote) { | ||
| 8074 | 8083 | ++i; | |
| 8075 | 8084 | } | |
| 8076 | - | ||
| 8085 | + if (i >= json_path.length() || // missing closing quote | ||
| 8086 | + i + 1 >= json_path.length() || // missing ] | ||
| 8087 | + json_path[i + 1] != ']') { | ||
| 8088 | + return {key, json_path}; | ||
| 8089 | + } | ||
| 8077 | 8090 | key = json_path.substr(key_start, i - key_start); | |
| 8078 | - | ||
| 8079 | - i += 2; | ||
| 8091 | + i += 2; // past quote and ] | ||
| 8080 | 8092 | } else if ((i+2 < json_path.size()) && json_path[i] == '[' && json_path[i+1] == '*' && json_path[i+2] == ']') { // i.e [*].additional_keys or [*]["additional_keys"] | |
| 8081 | 8093 | key = "*"; | |
| 8082 | 8094 | i += 3; | |
@@ -68653,6 +68665,12 @@ inline error_code array::for_each_at_path_with_wildcard(std::string_view json_pa | |||
| 68653 | 68665 | auto result_pair = get_next_key_and_json_path(json_path); | |
| 68654 | 68666 | std::string_view key = result_pair.first; | |
| 68655 | 68667 | std::string_view remaining_path = result_pair.second; | |
| 68668 | + // Empty key means the path segment could not be parsed (including malformed | ||
| 68669 | + // bracket-quoted keys). Without this check, an empty key is treated as index | ||
| 68670 | + // 0 and remaining_path may be unchanged, causing infinite recursion. | ||
| 68671 | + if (key.empty()) { | ||
| 68672 | + return INVALID_JSON_POINTER; | ||
| 68673 | + } | ||
| 68656 | 68674 | // Wildcard case | |
| 68657 | 68675 | if (key=="*"){ | |
| 68658 | 68676 | for(auto element: *this) { | |
@@ -72182,6 +72200,12 @@ inline error_code object::for_each_at_path_with_wildcard(std::string_view json_p | |||
| 72182 | 72200 | auto result_pair = get_next_key_and_json_path(json_path); | |
| 72183 | 72201 | std::string_view key = result_pair.first; | |
| 72184 | 72202 | std::string_view remaining_path = result_pair.second; | |
| 72203 | + // Empty key means the path segment could not be parsed (including malformed | ||
| 72204 | + // bracket-quoted keys). Match DOM at_path_with_wildcard and avoid treating | ||
| 72205 | + // "no progress" as a recursive lookup of "". | ||
| 72206 | + if (key.empty()) { | ||
| 72207 | + return INVALID_JSON_POINTER; | ||
| 72208 | + } | ||
| 72185 | 72209 | // Handle when its the case for wildcard | |
| 72186 | 72210 | if (key == "*") { | |
| 72187 | 72211 | // Loop through each field in the object | |
@@ -72547,7 +72571,7 @@ simdjson_inline parser::parser(size_t max_capacity) noexcept | |||
| 72547 | 72571 | ||
| 72548 | 72572 | simdjson_warn_unused simdjson_inline error_code parser::allocate(size_t new_capacity, size_t new_max_depth) noexcept { | |
| 72549 | 72573 | if (new_capacity > max_capacity()) { return CAPACITY; } | |
| 72550 | - if (string_buf && new_capacity == capacity() && new_max_depth == max_depth()) { return SUCCESS; } | ||
| 72574 | + if (string_buf && new_capacity <= capacity() && new_max_depth <= max_depth()) { return SUCCESS; } | ||
| 72551 | 72575 | ||
| 72552 | 72576 | // string_capacity copied from document::allocate | |
| 72553 | 72577 | _capacity = 0; | |
@@ -82023,6 +82047,12 @@ inline error_code array::for_each_at_path_with_wildcard(std::string_view json_pa | |||
| 82023 | 82047 | auto result_pair = get_next_key_and_json_path(json_path); | |
| 82024 | 82048 | std::string_view key = result_pair.first; | |
| 82025 | 82049 | std::string_view remaining_path = result_pair.second; | |
| 82050 | + // Empty key means the path segment could not be parsed (including malformed | ||
| 82051 | + // bracket-quoted keys). Without this check, an empty key is treated as index | ||
| 82052 | + // 0 and remaining_path may be unchanged, causing infinite recursion. | ||
| 82053 | + if (key.empty()) { | ||
| 82054 | + return INVALID_JSON_POINTER; | ||
| 82055 | + } | ||
| 82026 | 82056 | // Wildcard case | |
| 82027 | 82057 | if (key=="*"){ | |
| 82028 | 82058 | for(auto element: *this) { | |
@@ -85552,6 +85582,12 @@ inline error_code object::for_each_at_path_with_wildcard(std::string_view json_p | |||
| 85552 | 85582 | auto result_pair = get_next_key_and_json_path(json_path); | |
| 85553 | 85583 | std::string_view key = result_pair.first; | |
| 85554 | 85584 | std::string_view remaining_path = result_pair.second; | |
| 85585 | + // Empty key means the path segment could not be parsed (including malformed | ||
| 85586 | + // bracket-quoted keys). Match DOM at_path_with_wildcard and avoid treating | ||
| 85587 | + // "no progress" as a recursive lookup of "". | ||
| 85588 | + if (key.empty()) { | ||
| 85589 | + return INVALID_JSON_POINTER; | ||
| 85590 | + } | ||
| 85555 | 85591 | // Handle when its the case for wildcard | |
| 85556 | 85592 | if (key == "*") { | |
| 85557 | 85593 | // Loop through each field in the object | |
@@ -85917,7 +85953,7 @@ simdjson_inline parser::parser(size_t max_capacity) noexcept | |||
| 85917 | 85953 | ||
| 85918 | 85954 | simdjson_warn_unused simdjson_inline error_code parser::allocate(size_t new_capacity, size_t new_max_depth) noexcept { | |
| 85919 | 85955 | if (new_capacity > max_capacity()) { return CAPACITY; } | |
| 85920 | - if (string_buf && new_capacity == capacity() && new_max_depth == max_depth()) { return SUCCESS; } | ||
| 85956 | + if (string_buf && new_capacity <= capacity() && new_max_depth <= max_depth()) { return SUCCESS; } | ||
| 85921 | 85957 | ||
| 85922 | 85958 | // string_capacity copied from document::allocate | |
| 85923 | 85959 | _capacity = 0; | |
@@ -95880,6 +95916,12 @@ inline error_code array::for_each_at_path_with_wildcard(std::string_view json_pa | |||
| 95880 | 95916 | auto result_pair = get_next_key_and_json_path(json_path); | |
| 95881 | 95917 | std::string_view key = result_pair.first; | |
| 95882 | 95918 | std::string_view remaining_path = result_pair.second; | |
| 95919 | + // Empty key means the path segment could not be parsed (including malformed | ||
| 95920 | + // bracket-quoted keys). Without this check, an empty key is treated as index | ||
| 95921 | + // 0 and remaining_path may be unchanged, causing infinite recursion. | ||
| 95922 | + if (key.empty()) { | ||
| 95923 | + return INVALID_JSON_POINTER; | ||
| 95924 | + } | ||
| 95883 | 95925 | // Wildcard case | |
| 95884 | 95926 | if (key=="*"){ | |
| 95885 | 95927 | for(auto element: *this) { | |
@@ -99409,6 +99451,12 @@ inline error_code object::for_each_at_path_with_wildcard(std::string_view json_p | |||
| 99409 | 99451 | auto result_pair = get_next_key_and_json_path(json_path); | |
| 99410 | 99452 | std::string_view key = result_pair.first; | |
| 99411 | 99453 | std::string_view remaining_path = result_pair.second; | |
| 99454 | + // Empty key means the path segment could not be parsed (including malformed | ||
| 99455 | + // bracket-quoted keys). Match DOM at_path_with_wildcard and avoid treating | ||
| 99456 | + // "no progress" as a recursive lookup of "". | ||
| 99457 | + if (key.empty()) { | ||
| 99458 | + return INVALID_JSON_POINTER; | ||
| 99459 | + } | ||
| 99412 | 99460 | // Handle when its the case for wildcard | |
| 99413 | 99461 | if (key == "*") { | |
| 99414 | 99462 | // Loop through each field in the object | |
@@ -99774,7 +99822,7 @@ simdjson_inline parser::parser(size_t max_capacity) noexcept | |||
| 99774 | 99822 | ||
| 99775 | 99823 | simdjson_warn_unused simdjson_inline error_code parser::allocate(size_t new_capacity, size_t new_max_depth) noexcept { | |
| 99776 | 99824 | if (new_capacity > max_capacity()) { return CAPACITY; } | |
| 99777 | - if (string_buf && new_capacity == capacity() && new_max_depth == max_depth()) { return SUCCESS; } | ||
| 99825 | + if (string_buf && new_capacity <= capacity() && new_max_depth <= max_depth()) { return SUCCESS; } | ||
| 99778 | 99826 | ||
| 99779 | 99827 | // string_capacity copied from document::allocate | |
| 99780 | 99828 | _capacity = 0; | |
@@ -109737,6 +109785,12 @@ inline error_code array::for_each_at_path_with_wildcard(std::string_view json_pa | |||
| 109737 | 109785 | auto result_pair = get_next_key_and_json_path(json_path); | |
| 109738 | 109786 | std::string_view key = result_pair.first; | |
| 109739 | 109787 | std::string_view remaining_path = result_pair.second; | |
| 109788 | + // Empty key means the path segment could not be parsed (including malformed | ||
| 109789 | + // bracket-quoted keys). Without this check, an empty key is treated as index | ||
| 109790 | + // 0 and remaining_path may be unchanged, causing infinite recursion. | ||
| 109791 | + if (key.empty()) { | ||
| 109792 | + return INVALID_JSON_POINTER; | ||
| 109793 | + } | ||
| 109740 | 109794 | // Wildcard case | |
| 109741 | 109795 | if (key=="*"){ | |
| 109742 | 109796 | for(auto element: *this) { | |
@@ -113266,6 +113320,12 @@ inline error_code object::for_each_at_path_with_wildcard(std::string_view json_p | |||
| 113266 | 113320 | auto result_pair = get_next_key_and_json_path(json_path); | |
| 113267 | 113321 | std::string_view key = result_pair.first; | |
| 113268 | 113322 | std::string_view remaining_path = result_pair.second; | |
| 113323 | + // Empty key means the path segment could not be parsed (including malformed | ||
| 113324 | + // bracket-quoted keys). Match DOM at_path_with_wildcard and avoid treating | ||
| 113325 | + // "no progress" as a recursive lookup of "". | ||
| 113326 | + if (key.empty()) { | ||
| 113327 | + return INVALID_JSON_POINTER; | ||
| 113328 | + } | ||
| 113269 | 113329 | // Handle when its the case for wildcard | |
| 113270 | 113330 | if (key == "*") { | |
| 113271 | 113331 | // Loop through each field in the object | |
@@ -113631,7 +113691,7 @@ simdjson_inline parser::parser(size_t max_capacity) noexcept | |||
| 113631 | 113691 | ||
| 113632 | 113692 | simdjson_warn_unused simdjson_inline error_code parser::allocate(size_t new_capacity, size_t new_max_depth) noexcept { | |
| 113633 | 113693 | if (new_capacity > max_capacity()) { return CAPACITY; } | |
| 113634 | - if (string_buf && new_capacity == capacity() && new_max_depth == max_depth()) { return SUCCESS; } | ||
| 113694 | + if (string_buf && new_capacity <= capacity() && new_max_depth <= max_depth()) { return SUCCESS; } | ||
| 113635 | 113695 | ||
| 113636 | 113696 | // string_capacity copied from document::allocate | |
| 113637 | 113697 | _capacity = 0; | |
@@ -123709,6 +123769,12 @@ inline error_code array::for_each_at_path_with_wildcard(std::string_view json_pa | |||
| 123709 | 123769 | auto result_pair = get_next_key_and_json_path(json_path); | |
| 123710 | 123770 | std::string_view key = result_pair.first; | |
| 123711 | 123771 | std::string_view remaining_path = result_pair.second; | |
| 123772 | + // Empty key means the path segment could not be parsed (including malformed | ||
| 123773 | + // bracket-quoted keys). Without this check, an empty key is treated as index | ||
| 123774 | + // 0 and remaining_path may be unchanged, causing infinite recursion. | ||
| 123775 | + if (key.empty()) { | ||
| 123776 | + return INVALID_JSON_POINTER; | ||
| 123777 | + } | ||
| 123712 | 123778 | // Wildcard case | |
| 123713 | 123779 | if (key=="*"){ | |
| 123714 | 123780 | for(auto element: *this) { | |
@@ -127238,6 +127304,12 @@ inline error_code object::for_each_at_path_with_wildcard(std::string_view json_p | |||
| 127238 | 127304 | auto result_pair = get_next_key_and_json_path(json_path); | |
| 127239 | 127305 | std::string_view key = result_pair.first; | |
| 127240 | 127306 | std::string_view remaining_path = result_pair.second; | |
| 127307 | + // Empty key means the path segment could not be parsed (including malformed | ||
| 127308 | + // bracket-quoted keys). Match DOM at_path_with_wildcard and avoid treating | ||
| 127309 | + // "no progress" as a recursive lookup of "". | ||
| 127310 | + if (key.empty()) { | ||
| 127311 | + return INVALID_JSON_POINTER; | ||
| 127312 | + } | ||
| 127241 | 127313 | // Handle when its the case for wildcard | |
| 127242 | 127314 | if (key == "*") { | |
| 127243 | 127315 | // Loop through each field in the object | |
@@ -127603,7 +127675,7 @@ simdjson_inline parser::parser(size_t max_capacity) noexcept | |||
| 127603 | 127675 | ||
| 127604 | 127676 | simdjson_warn_unused simdjson_inline error_code parser::allocate(size_t new_capacity, size_t new_max_depth) noexcept { | |
| 127605 | 127677 | if (new_capacity > max_capacity()) { return CAPACITY; } | |
| 127606 | - if (string_buf && new_capacity == capacity() && new_max_depth == max_depth()) { return SUCCESS; } | ||
| 127678 | + if (string_buf && new_capacity <= capacity() && new_max_depth <= max_depth()) { return SUCCESS; } | ||
| 127607 | 127679 | ||
| 127608 | 127680 | // string_capacity copied from document::allocate | |
| 127609 | 127681 | _capacity = 0; | |
@@ -137998,6 +138070,12 @@ inline error_code array::for_each_at_path_with_wildcard(std::string_view json_pa | |||
| 137998 | 138070 | auto result_pair = get_next_key_and_json_path(json_path); | |
| 137999 | 138071 | std::string_view key = result_pair.first; | |
| 138000 | 138072 | std::string_view remaining_path = result_pair.second; | |
| 138073 | + // Empty key means the path segment could not be parsed (including malformed | ||
| 138074 | + // bracket-quoted keys). Without this check, an empty key is treated as index | ||
| 138075 | + // 0 and remaining_path may be unchanged, causing infinite recursion. | ||
| 138076 | + if (key.empty()) { | ||
| 138077 | + return INVALID_JSON_POINTER; | ||
| 138078 | + } | ||
| 138001 | 138079 | // Wildcard case | |
| 138002 | 138080 | if (key=="*"){ | |
| 138003 | 138081 | for(auto element: *this) { | |
@@ -141527,6 +141605,12 @@ inline error_code object::for_each_at_path_with_wildcard(std::string_view json_p | |||
| 141527 | 141605 | auto result_pair = get_next_key_and_json_path(json_path); | |
| 141528 | 141606 | std::string_view key = result_pair.first; | |
| 141529 | 141607 | std::string_view remaining_path = result_pair.second; | |
| 141608 | + // Empty key means the path segment could not be parsed (including malformed | ||
| 141609 | + // bracket-quoted keys). Match DOM at_path_with_wildcard and avoid treating | ||
| 141610 | + // "no progress" as a recursive lookup of "". | ||
| 141611 | + if (key.empty()) { | ||
| 141612 | + return INVALID_JSON_POINTER; | ||
| 141613 | + } | ||
| 141530 | 141614 | // Handle when its the case for wildcard | |
| 141531 | 141615 | if (key == "*") { | |
| 141532 | 141616 | // Loop through each field in the object | |
@@ -141892,7 +141976,7 @@ simdjson_inline parser::parser(size_t max_capacity) noexcept | |||
| 141892 | 141976 | ||
| 141893 | 141977 | simdjson_warn_unused simdjson_inline error_code parser::allocate(size_t new_capacity, size_t new_max_depth) noexcept { | |
| 141894 | 141978 | if (new_capacity > max_capacity()) { return CAPACITY; } | |
| 141895 | - if (string_buf && new_capacity == capacity() && new_max_depth == max_depth()) { return SUCCESS; } | ||
| 141979 | + if (string_buf && new_capacity <= capacity() && new_max_depth <= max_depth()) { return SUCCESS; } | ||
| 141896 | 141980 | ||
| 141897 | 141981 | // string_capacity copied from document::allocate | |
| 141898 | 141982 | _capacity = 0; | |
@@ -151761,6 +151845,12 @@ inline error_code array::for_each_at_path_with_wildcard(std::string_view json_pa | |||
| 151761 | 151845 | auto result_pair = get_next_key_and_json_path(json_path); | |
| 151762 | 151846 | std::string_view key = result_pair.first; | |
| 151763 | 151847 | std::string_view remaining_path = result_pair.second; | |
| 151848 | + // Empty key means the path segment could not be parsed (including malformed | ||
| 151849 | + // bracket-quoted keys). Without this check, an empty key is treated as index | ||
| 151850 | + // 0 and remaining_path may be unchanged, causing infinite recursion. | ||
| 151851 | + if (key.empty()) { | ||
| 151852 | + return INVALID_JSON_POINTER; | ||
| 151853 | + } | ||
| 151764 | 151854 | // Wildcard case | |
| 151765 | 151855 | if (key=="*"){ | |
| 151766 | 151856 | for(auto element: *this) { | |
@@ -155290,6 +155380,12 @@ inline error_code object::for_each_at_path_with_wildcard(std::string_view json_p | |||
| 155290 | 155380 | auto result_pair = get_next_key_and_json_path(json_path); | |
| 155291 | 155381 | std::string_view key = result_pair.first; | |
| 155292 | 155382 | std::string_view remaining_path = result_pair.second; | |
| 155383 | + // Empty key means the path segment could not be parsed (including malformed | ||
| 155384 | + // bracket-quoted keys). Match DOM at_path_with_wildcard and avoid treating | ||
| 155385 | + // "no progress" as a recursive lookup of "". | ||
| 155386 | + if (key.empty()) { | ||
| 155387 | + return INVALID_JSON_POINTER; | ||
| 155388 | + } | ||
| 155293 | 155389 | // Handle when its the case for wildcard | |
| 155294 | 155390 | if (key == "*") { | |
| 155295 | 155391 | // Loop through each field in the object | |
@@ -155655,7 +155751,7 @@ simdjson_inline parser::parser(size_t max_capacity) noexcept | |||
| 155655 | 155751 | ||
| 155656 | 155752 | simdjson_warn_unused simdjson_inline error_code parser::allocate(size_t new_capacity, size_t new_max_depth) noexcept { | |
| 155657 | 155753 | if (new_capacity > max_capacity()) { return CAPACITY; } | |
| 155658 | - if (string_buf && new_capacity == capacity() && new_max_depth == max_depth()) { return SUCCESS; } | ||
| 155754 | + if (string_buf && new_capacity <= capacity() && new_max_depth <= max_depth()) { return SUCCESS; } | ||
| 155659 | 155755 | ||
| 155660 | 155756 | // string_capacity copied from document::allocate | |
| 155661 | 155757 | _capacity = 0; | |
@@ -165547,6 +165643,12 @@ inline error_code array::for_each_at_path_with_wildcard(std::string_view json_pa | |||
| 165547 | 165643 | auto result_pair = get_next_key_and_json_path(json_path); | |
| 165548 | 165644 | std::string_view key = result_pair.first; | |
| 165549 | 165645 | std::string_view remaining_path = result_pair.second; | |
| 165646 | + // Empty key means the path segment could not be parsed (including malformed | ||
| 165647 | + // bracket-quoted keys). Without this check, an empty key is treated as index | ||
| 165648 | + // 0 and remaining_path may be unchanged, causing infinite recursion. | ||
| 165649 | + if (key.empty()) { | ||
| 165650 | + return INVALID_JSON_POINTER; | ||
| 165651 | + } | ||
| 165550 | 165652 | // Wildcard case | |
| 165551 | 165653 | if (key=="*"){ | |
| 165552 | 165654 | for(auto element: *this) { | |
@@ -169076,6 +169178,12 @@ inline error_code object::for_each_at_path_with_wildcard(std::string_view json_p | |||
| 169076 | 169178 | auto result_pair = get_next_key_and_json_path(json_path); | |
| 169077 | 169179 | std::string_view key = result_pair.first; | |
| 169078 | 169180 | std::string_view remaining_path = result_pair.second; | |
| 169181 | + // Empty key means the path segment could not be parsed (including malformed | ||
| 169182 | + // bracket-quoted keys). Match DOM at_path_with_wildcard and avoid treating | ||
| 169183 | + // "no progress" as a recursive lookup of "". | ||
| 169184 | + if (key.empty()) { | ||
| 169185 | + return INVALID_JSON_POINTER; | ||
| 169186 | + } | ||
| 169079 | 169187 | // Handle when its the case for wildcard | |
| 169080 | 169188 | if (key == "*") { | |
| 169081 | 169189 | // Loop through each field in the object | |
@@ -169441,7 +169549,7 @@ simdjson_inline parser::parser(size_t max_capacity) noexcept | |||
| 169441 | 169549 | ||
| 169442 | 169550 | simdjson_warn_unused simdjson_inline error_code parser::allocate(size_t new_capacity, size_t new_max_depth) noexcept { | |
| 169443 | 169551 | if (new_capacity > max_capacity()) { return CAPACITY; } | |
| 169444 | - if (string_buf && new_capacity == capacity() && new_max_depth == max_depth()) { return SUCCESS; } | ||
| 169552 | + if (string_buf && new_capacity <= capacity() && new_max_depth <= max_depth()) { return SUCCESS; } | ||
| 169445 | 169553 | ||
| 169446 | 169554 | // string_capacity copied from document::allocate | |
| 169447 | 169555 | _capacity = 0; | |
@@ -179337,6 +179445,12 @@ inline error_code array::for_each_at_path_with_wildcard(std::string_view json_pa | |||
| 179337 | 179445 | auto result_pair = get_next_key_and_json_path(json_path); | |
| 179338 | 179446 | std::string_view key = result_pair.first; | |
| 179339 | 179447 | std::string_view remaining_path = result_pair.second; | |
| 179448 | + // Empty key means the path segment could not be parsed (including malformed | ||
| 179449 | + // bracket-quoted keys). Without this check, an empty key is treated as index | ||
| 179450 | + // 0 and remaining_path may be unchanged, causing infinite recursion. | ||
| 179451 | + if (key.empty()) { | ||
| 179452 | + return INVALID_JSON_POINTER; | ||
| 179453 | + } | ||
| 179340 | 179454 | // Wildcard case | |
| 179341 | 179455 | if (key=="*"){ | |
| 179342 | 179456 | for(auto element: *this) { | |
@@ -182866,6 +182980,12 @@ inline error_code object::for_each_at_path_with_wildcard(std::string_view json_p | |||
| 182866 | 182980 | auto result_pair = get_next_key_and_json_path(json_path); | |
| 182867 | 182981 | std::string_view key = result_pair.first; | |
| 182868 | 182982 | std::string_view remaining_path = result_pair.second; | |
| 182983 | + // Empty key means the path segment could not be parsed (including malformed | ||
| 182984 | + // bracket-quoted keys). Match DOM at_path_with_wildcard and avoid treating | ||
| 182985 | + // "no progress" as a recursive lookup of "". | ||
| 182986 | + if (key.empty()) { | ||
| 182987 | + return INVALID_JSON_POINTER; | ||
| 182988 | + } | ||
| 182869 | 182989 | // Handle when its the case for wildcard | |
| 182870 | 182990 | if (key == "*") { | |
| 182871 | 182991 | // Loop through each field in the object | |
@@ -183231,7 +183351,7 @@ simdjson_inline parser::parser(size_t max_capacity) noexcept | |||
| 183231 | 183351 | ||
| 183232 | 183352 | simdjson_warn_unused simdjson_inline error_code parser::allocate(size_t new_capacity, size_t new_max_depth) noexcept { | |
| 183233 | 183353 | if (new_capacity > max_capacity()) { return CAPACITY; } | |
| 183234 | - if (string_buf && new_capacity == capacity() && new_max_depth == max_depth()) { return SUCCESS; } | ||
| 183354 | + if (string_buf && new_capacity <= capacity() && new_max_depth <= max_depth()) { return SUCCESS; } | ||
| 183235 | 183355 | ||
| 183236 | 183356 | // string_capacity copied from document::allocate | |
| 183237 | 183357 | _capacity = 0; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments