Jens-G opened a new pull request, #3678:
URL: https://github.com/apache/thrift/pull/3678
`thrift_multiplexed_processor_process_impl` passed the method name straight
to
`strtok_r` as soon as `read_message_begin` reported success:
```c
for (token = strtok_r(fname, THRIFT_MULTIPLEXED_PROTOCOL_DEFAULT_SEPARATOR,
&state), ...
```
A protocol that reports success without writing the name leaves `fname` NULL,
and `strtok_r` then continues from its saved state pointer, which starts out
NULL as well. The name is also used further down to build the error text for
an
unregistered service and the header of the exception reply.
`thrift_stored_message_protocol_read_message_begin` returns success with
`*name = g_strdup (self->name)`, so a stored-message protocol constructed
without a `name` produces exactly that input. The binary and compact
protocols
always allocate a name on success, so this does not arise from the protocols
the multiplexed processor is normally driven with.
This mirrors what `thrift_dispatch_processor.c` — the file this code is
copied
from, as the comment at line 183 notes — already does since f9c592504: a
message the protocol did not name is rejected rather than dispatched.
### Change
Reject the message right after the header read, before the message-type
check,
matching the order the dispatch processor uses. The existing
`THRIFT_MULTIPLEXED_PROCESSOR_ERROR_MESSAGE_WRONGLY_MULTIPLEXED` code is
reused
so no value is added to the public header.
### Tests
`testmultiplexedprocessor.c` gains `MessageWithoutName`, driving the
processor
with a stub protocol that reports success for the header without naming the
method. Against the unpatched processor the case terminates the test binary
with SIGSEGV; with the change it asserts the error domain and code.
Verified on both build systems:
- CMake: full c_glib suite, 39/39 passing
- Autotools: `bootstrap.sh` / `configure` / `make`, all four
`testmultiplexedprocessor` cases passing
- Clean under `G_DEBUG=fatal-warnings`, no new compiler warnings
No build-file changes — the test file is already registered in
`CMakeLists.txt`
and `Makefile.am`.
Generated-by: Claude Opus 5 (1M context)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]