Session::compute_json, compute_bincode and dimension silently answer for a different expression when the Term belongs to another session
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 73/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- backend-api-design
Research direction
Read the C++ client methods in client.hpp: compute_json, compute_bincode, dimension, eval, and compute (around the line references in the issue). Compare how they handle a Term from another Session, then run the relevant C++ client tests or reproduce the supplied example. Done means all four methods reject a foreign-session Term consistently with compute.
Written by the indexing model from the issue text.
Description
Session::compute_json, compute_bincode and dimension never check which session a Term belongs to, so a term from another session is silently read as this session's node with the same handle — the call returns the compute record of a different expression, while Session::compute rejects the very same term.
// repro.cpp
#include <cstdio>
#include "rssn/client.hpp"
using namespace rssn::client;
int main() {
Session a, b;
const auto x = a.sym("x"); // handle 9 in a
const auto y = b.sym("y"); // handle 9 in b
std::printf("x.handle=%u y.handle=%u\n", x.handle(), y.handle());
try { a.compute(y); } catch (const Error &e) {
std::printf("a.compute(y) -> %s: %s\n", status_name(e.status()), e.what()); }
std::printf("a.compute_json(y) -> %s\n", a.compute_json(y).c_str());
std::printf("b.compute_json(y) -> %s\n", b.compute_json(y).c_str());
std::printf("a.dimension(y) -> [%s]\n", a.dimension(y).c_str());
std::printf("a.compute_bincode(y)==a.compute_bincode(x): %d\n",
a.compute_bincode(y) == a.compute_bincode(x));
}
Actual output (twice, identical):
x.handle=9 y.handle=9
a.compute(y) -> invalid_argument: the request belongs to another session
a.compute_json(y) -> {"diagnostic_codes":[],"diagnostics":[],"dimension":"?x","error":null,"iterations":1,"reduced":true,"term":"x","value":null}
b.compute_json(y) -> {"diagnostic_codes":[],"diagnostics":[],"dimension":"?y","error":null,"iterations":1,"reduced":true,"term":"y","value":null}
a.dimension(y) -> [?x]
a.compute_bincode(y)==a.compute_bincode(x): 1
Why it is wrong: the record returned for y describes x — "term":"x" instead of "term":"y", and the bincode is byte-identical to the bincode of x. Session::compute (client.hpp:868-874) treats the same argument as an error ("the request belongs to another session"), so the four members disagree about a term that does not belong to the session. Handles are per-session node indices, so this is a silent wrong answer, not a diagnostic: a caller that logs compute_json of a request built elsewhere records a different expression.
Mechanism: compute_json (client.hpp:545), compute_bincode (client.hpp:556) and dimension (client.hpp:568) pass term.handle() to the C entry point without the term.session() != pointer_ guard that compute performs. Session::eval (client.hpp:578) has the same hole in the other direction: it delegates to term.eval(), so it evaluates in the term's session. The guard belongs in all four.
rssn 0.3.0, C++ client (header-only) over the release C library, Windows x86_64.
- Dominant language
- Rust
- Stars
- 36
- Forks
- 3
- Avg merge
- 14h 51m
- Merged PRs (30d)
- 29
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Apich-Organization/rssn
-
num_ode_rk4_adaptive rejects atol = 0 while accepting rtol = 0 and while num_ode_dopri5 accepts bothOpenarea/ode-pde good first issue help wanted kind/contract severity/4-minor
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Apich-Organization/rssn#383 ·
Maintainers usually reply within 1 day
-
area/numerical good first issue help wanted kind/doc-mismatch severity/5-trivial
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Apich-Organization/rssn#373 ·
Maintainers usually reply within 1 day
-
area/numerical good first issue help wanted kind/doc-mismatch severity/4-minor
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Apich-Organization/rssn#371 ·
Maintainers usually reply within 1 day
-
json_encode() re-emits a decoded empty JSON object as [], so {} and {"":1} are not round-trip stableOpenarea/api-bindings good first issue help wanted kind/contract severity/4-minor
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Apich-Organization/rssn#361 ·
Maintainers usually reply within 1 day
-
area/statistics good first issue help wanted kind/wrong-result severity/4-minor
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Apich-Organization/rssn#362 ·
Maintainers usually reply within 1 day
All issues in Apich-Organization/rssn
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
autofixer: follow-up triage: bug triage: classified triage: correctness triage: has-reproducer
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
tursodatabase/turso#13221 ·
Maintainers usually reply within 1 day
-
Update Wasmtime to 48.0.11 for RUSTSEC-2026-0648Possibly taken @flyingrobots claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
flyingrobots/edict#457 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
-
O-windows relnotes relnotes-needs-review relnotes-tracking-issue T-libs
Difficulty 1/5 Under an hour Newbie friendliness 68/100
Maintainers usually reply within 1 day