-
-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bad conversion of NULL when passing integer vector #1564
Comments
Generally, for any |
Thanks for the analysis. I'm not sure I follow. Lines 8681 to 8689 in a871789
In this code, line 8689 (the one shown in CRAN's backtrace) checks Can this be replicated with Docker and https://github.com/cynkra/docker-images/pkgs/container/docker-images%2Frigraph-san ? |
Fortunately, the fix is easy. |
OK, I see. I didn't read the code carefully, just observed the behaviour. |
The CI shows another unrelated error, hopefully similarly simple to fix. https://github.com/igraph/rigraph/actions/runs/11601556838/job/32304898594#step:5:6515 |
So what happened was that There are a lot of In C, generally, the convention is that a vector parameter can be omitted by passing When a parameter cannot be omitted, but the user still passes This should be reviewed carefully, the glue code should be adapted. What I can do on the C side is to make sure that |
@ntamas What is the proper way to specify an optional vector parameter in |
See igraph/igraph#2690 and #1567 |
When passing an integer vector from R to C, the
NULL
value is converted to an empty vector.This is the ultimate cause of the UBSan failure that CRAN caught,
It's not just an UBSan warning.
sample_motifs()
is essentially broken, and likely so are some other functions that take optional integer vectors.In
rinterface.c
, I see this:It should produce a
NULL
pointer instead of an empty vector.This should be changed, but be aware that doing so may cause issues elsewhere, which will need to be fixed as well.
I don't see the null check in
types-RC.yaml
, so I assume it comes directly from Stimulus. Can you have a look, @Antonov548 ?The text was updated successfully, but these errors were encountered: