Skip to content

TGraph2D::Build function may leave the newly created object in inconsistent non-initialised state #21366

@SergueiEK

Description

@SergueiEK

Check duplicate issues.

  • Checked for duplicates

Description

If I create a new TGraph2D object with 0 points the new object is not properly initialized. The issue is that the TGraph2D::Build(n) function that is called by the constructors returns immediately if the number of points equals to zero. As a result the new TGraph2D object has most of its member attributes non-initialized and an attempt to use it (for example by calling SetDirectory() function) causes Segmentation Fault.

Reproducer

TGraph2D * g = new TGraph2d(0);
g->SetDirectory(0);

ROOT version

6.38.00

Installation method

CERN LCG_109 standard installation

Operating system

Alma 9 Linux

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions