Closed Bug 2098223 Opened 9 days ago Closed 9 days ago

Flow id serialization mismatch between c++ and rust

Categories

(Core :: Gecko Profiler, defect)

defect

Tracking

()

RESOLVED FIXED
163 Branch
Tracking Status
firefox163 --- fixed

People

(Reporter: kats, Assigned: kats)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fxpe])

Attachments

(1 external file)

Rust code: https://searchfox.org/firefox-main/rev/4de791e9c62b308a5ab1e4464dc1fd19d8c4d13b/tools/profiler/rust-api/src/marker/flow_id.rs#34
C++ code: https://searchfox.org/firefox-main/rev/4de791e9c62b308a5ab1e4464dc1fd19d8c4d13b/mozglue/baseprofiler/public/BaseProfileJSONWriter.h#334

The C++ code says it's null-terminating the string but is actually appending a '0' character. This causes a mismatch between the flow id being serialized in C++ vs Rust. The null termination doesn't seem needed since the Span constructor the array gets passed to handles fixed-length arrays, so we should just be able to drop that and use an array of size 16.

HexString() meant to null terminate its buffer but wrote the character '0'.
This made the flow id serialization incompatible with the Rust counterpart in
FlowId::to_hex. The null termination is unnecessary here so we can just drop
the spurious '0'.

Attachment #9691595 - Attachment description: WIP: Bug 2098223 - Write flow ids as 16 hex digits. r?#profiler-reviewers → Bug 2098223 - Write flow ids as 16 hex digits. r?#profiler-reviewers
Status: NEW → RESOLVED
Closed: 9 days ago
Resolution: --- → FIXED
Target Milestone: --- → 163 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: