-
Notifications
You must be signed in to change notification settings - Fork 86
Open
Labels
Description
Describe the bug, including details regarding any error messages, version, and platform.
graphar::builder::Vertexprovides a default constructor that does not initializeid_. However,GetId()can still be called and may return an uninitialized value, which is undefined behavior.
incubator-graphar/cpp/src/graphar/high-level/vertices_builder.h
Lines 52 to 68 in 7bad8ec
| class Vertex { | |
| public: | |
| Vertex() : empty_(true) {} | |
| /** | |
| * @brief Initialize the vertex with a given id. | |
| * | |
| * @param id The id of the vertex. | |
| */ | |
| explicit Vertex(IdType id) : id_(id), empty_(false) {} | |
| /** | |
| * @brief Get id of the vertex. | |
| * | |
| * @return The id of the vertex. | |
| */ | |
| inline IdType GetId() const noexcept { return id_; } |
graphar::builder::Vertexalso providesSetId(IdType id), butSetIddoes not setempty_to false. This seems inconsistent with theVertex(IdType id)constructor (which setsempty_ = false) and is likely not the expected behavior.
incubator-graphar/cpp/src/graphar/high-level/vertices_builder.h
Lines 70 to 75 in 7bad8ec
| /** | |
| * @brief Set id of the vertex. | |
| * | |
| * @param id The id of the vertex. | |
| */ | |
| inline void SetId(IdType id) { id_ = id; } |
Component(s)
C++
Reactions are currently unavailable