`basic_pbf_builder<TBuffer, T>` submessage constructor does not enforce correct parent tag type.
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- cpp
- Domain
- backend-api-design
Research direction
Start at the basic_pbf_builder submessage constructor shown in the issue and inspect the related basic_pbf_writer, pbf_tag_type, and tag-type definitions. Verify how parent and tag types are represented, then add coverage showing that valid construction remains possible and an incorrect parent tag type is rejected at compile time.
Written by the indexing model from the issue text.
Description
This constructor of basic_pbf_builder:
/**
* Construct a pbf_builder for a submessage from the pbf_message or
* pbf_writer of the parent message.
*
* @param parent_writer The parent pbf_message or pbf_writer
* @param tag Tag of the field that will be written
*/
template <typename P>
basic_pbf_builder(basic_pbf_writer<TBuffer>& parent_writer, P tag) :
basic_pbf_writer<TBuffer>{parent_writer, pbf_tag_type(tag)} {
}
Does not enforce that P is the correct tag type of parent_writer.
Would it be acceptable to submit a PR that replaces or overloads this constructor with:
/**
* Construct a pbf_builder for a submessage from the pbf_builder of the parent message.
*
* @param parent_writer The parent pbf_builder
* @param tag Tag of the field that will be written
*/
template <typename P>
basic_pbf_builder(basic_pbf_builder<TBuffer, P>& parent_builder, P tag) :
basic_pbf_writer<TBuffer>{parent_builder, pbf_tag_type(tag)} {
}
I did not verify that this compiles, but I think it explains the idea.
- Dominant language
- C++
- Stars
- 381
- Forks
- 83
- PR merge metrics
- No merged PRs in 30d
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 mapbox/protozero
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 42/100
All issues in mapbox/protozero
Similar issues
-
bug chart-audit
Difficulty 1/5 Under an hour Newbie friendliness 92/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
godotengine/godot#124120 ·
Maintainers usually reply within 1 day
-
Component: R Type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
apache/arrow#51695 · 1 comment ·
Maintainers usually reply within 1 day
-
HasBacktrace Priority-Critical
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
azerothcore/azerothcore-wotlk#27921 ·
Maintainers usually reply within 1 day
-
area/ysql kind/bug priority/medium
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
yugabyte/yugabyte-db#34584 ·
Maintainers usually reply within 1 day