This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new e06e25221d4 [fix](jsonb) Avoid crashing caused by invalid path
(#50978) (#50994)
e06e25221d4 is described below
commit e06e25221d45ce4c19d254511ef52bbf90c52ac3
Author: Jerry Hu <[email protected]>
AuthorDate: Sun May 18 22:28:04 2025 +0800
[fix](jsonb) Avoid crashing caused by invalid path (#50978) (#50994)
pick #50978
---
be/src/util/jsonb_document.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/be/src/util/jsonb_document.h b/be/src/util/jsonb_document.h
index 0e4fea77f13..fb87114f886 100644
--- a/be/src/util/jsonb_document.h
+++ b/be/src/util/jsonb_document.h
@@ -1499,6 +1499,10 @@ inline bool JsonbPath::parsePath(Stream* stream,
JsonbPath* path) {
// advance past the .
stream->skip(1);
+ if (stream->exhausted()) {
+ return false;
+ }
+
// $.[0]
if (stream->peek() == BEGIN_ARRAY) {
return parse_array(stream, path);
@@ -1523,6 +1527,10 @@ inline bool JsonbPath::parse_array(Stream* stream,
JsonbPath* path) {
stream->set_leg_ptr(const_cast<char*>(stream->position()));
stream->add_leg_len();
stream->skip(1);
+ if (stream->exhausted()) {
+ return false;
+ }
+
if (stream->peek() == END_ARRAY) {
std::unique_ptr<leg_info> leg(
new leg_info(stream->get_leg_ptr(), stream->get_leg_len(),
0, ARRAY_CODE));
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]