Skip to content

core: fix empty array write memory leak && fix(driver): accept UINT64 write values for numeric tags - #2962

Merged
fengzeroz merged 2 commits into
emqx:mainfrom
ZhouBox:main
Nov 13, 2026
Merged

fengzeroz merged 2 commits into
emqx:mainfrom
ZhouBox:main

Conversation

@ZhouBox

@ZhouBox ZhouBox commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Sparkplug B encodes UInt64 metrics as an unsigned 64-bit value, which cannot
be represented by an INT64 write value. Accept NEU_TYPE_UINT64 writes for
numeric tags, evaluate the range with the unsigned value, and extend
cal_decimal and float conversion accordingly. INT64 write values keep their
signed semantics.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T05:54:09.991639Z 3b72cc7 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codecov-commenter

codecov-commenter commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 42.53731% with 77 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.89%. Comparing base (ad8a4da) to head (3b72cc7).

Files with missing lines Patch % Lines
src/adapter/driver/driver.c 42.46% 42 Missing ⚠️
plugins/restful/rw_handle.c 20.68% 23 Missing ⚠️
src/adapter/adapter.c 0.00% 4 Missing ⚠️
src/core/manager.c 33.33% 4 Missing ⚠️
include/neuron/msg.h 83.33% 3 Missing ⚠️
src/parser/neu_json_rw.c 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2962       +/-   ##
===========================================
+ Coverage   54.07%   68.89%   +14.82%     
===========================================
  Files         137      137               
  Lines       34649    34720       +71     
===========================================
+ Hits        18736    23922     +5186     
+ Misses      15913    10798     -5115     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3b72cc7d74

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/parser/neu_json_rw.c
req->groups[i].tags[k].t = v_elems[1].t;
req->groups[i].tags[k].value = v_elems[1].v;
if (req->groups[i].tags[k].t == NEU_JSON_OBJECT) {
json_incref(req->groups[i].tags[k].value.val_object);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Release retained custom values after decode failures

When an authenticated management caller (or a deployment with JWT disabled) sends /api/v2/write/gtags with a valid, large object value followed by a malformed tag or group, this json_incref has no matching decrement: the later failure branches in decode_write_gtags_req_json free only the tag/group arrays, neu_json_decode_write_gtags_req_json then frees only req, and the wrapper drops the root reference. The added reference can therefore retain nearly the 4 MiB request limit on every failed request, so repeated malformed writes can exhaust the gateway; release all previously retained object values on every partial-decode failure (or centralize that cleanup).

AGENTS.md reference: AGENTS.md:L26-L26

Useful? React with 👍 / 👎.

@ZhouBox
ZhouBox requested a review from fengzeroz November 13, 2026 06:06
@fengzeroz
fengzeroz merged commit 2be2697 into emqx:main Nov 13, 2026
24 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants