Skip to content

Fix optional CallbackQuery message parsing#14

Merged
Royna2544 merged 1 commit into
masterfrom
codex/fix-unchecked-json-access-for-optional-fields
May 31, 2026
Merged

Fix optional CallbackQuery message parsing#14
Royna2544 merged 1 commit into
masterfrom
codex/fix-unchecked-json-access-for-optional-fields

Conversation

@Royna2544

Copy link
Copy Markdown
Owner

Motivation

  • Prevent a crash/DoS during JSON parsing by avoiding unchecked nlohmann::json::operator[] access for the optional CallbackQuery::message field.

Description

  • Replace the unsafe result->message = parse(data["message"]); with the key-aware helper result->message = parse<MaybeInaccessibleMessage>(data, "message"); in src/types/CallbackQuery.cpp to yield std::nullopt when the key is absent.

Testing

  • No automated tests were executed because a full CMake/build could not be run due to missing nlohmann_json development files and restricted network access preventing dependency retrieval; the change is intentionally minimal and follows the existing key-aware parsing pattern used elsewhere.

Codex Task

@Royna2544 Royna2544 merged commit a138900 into master May 31, 2026
1 check failed
@Royna2544 Royna2544 deleted the codex/fix-unchecked-json-access-for-optional-fields branch May 31, 2026 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant