Skip to content

HRG functions do not check arguments #1074

@szhorvat

Description

@szhorvat

What happens?

Functions that take an igraphHRG object do not check that their input is indeed an igraphHRG. This can lead to crashes or worse.

To Reproduce

> hrg_tree(make_ring(5))
Error in .subscript.2ary(x, i, , drop = drop) : subscript out of bounds
> hrg_tree(123)
IGRAPH 2d6cb1e D--- 3 2 -- 
+ attr: probability (v/n)
+ edges from 2d6cb1e:
[1] 3->1 3->1

(wrong output, and out-of-bounds memory access)

sample_hrg(123)

(typically crashes)

> sample_hrg(make_ring(5))
Error in .subscript.2ary(x, i, , drop = drop) : subscript out of bounds

Metadata

Metadata

Assignees

Labels

upkeepmaintenance, infrastructure, and similar

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions