Conversation
b076313 to
9b8d3dc
Compare
| if ctx.is_null() { | ||
| return raw::Status::Err as _; | ||
| } | ||
|
|
||
| if argv.is_null() && argc != 0 { | ||
| return raw::Status::Err as _; | ||
| } | ||
|
|
||
| if !argv.is_null() && unsafe { (*argv).is_null() } { | ||
| return raw::Status::Err as _; | ||
| } | ||
|
|
||
| if !argv.is_null() && unsafe { !(*argv).is_null() } && (argc.is_negative() || argc == 0) { | ||
| return raw::Status::Err as _; | ||
| } | ||
|
|
There was a problem hiding this comment.
This can be collapsed into
if ctx.is_null() || (argv.is_null() && argc != 0) || (!argv.is_null() && unsafe { (*argv).is_null() })
|| (!argv.is_null() && unsafe { !(*argv).is_null() } && (argc.is_negative() || argc == 0)) {
return raw::Status::Err as _;
}But doesn't look good.
| use $crate::configuration::get_enum_default_config_value; | ||
|
|
||
| if ctx.is_null() { | ||
| return raw::Status::Err as _; |
There was a problem hiding this comment.
Maybe we should log why we did not start
There was a problem hiding this comment.
Log with what? You mean just eprintln!?
There was a problem hiding this comment.
We can log even with NULL context. If we can not log its better to crash with a huge panic here. If this will happened and exit silently we will spend hours trying to guess why the module did not start.
There was a problem hiding this comment.
Sure, let's log something then.
| return raw::Status::Err as _; | ||
| } | ||
|
|
||
| if !argv.is_null() && unsafe { (*argv).is_null() } { |
There was a problem hiding this comment.
You assume here that none NULL argv means that argc > 0. I am not sure this is promise.
There was a problem hiding this comment.
Yes, I am also not sure.
There was a problem hiding this comment.
I am also not sure if the negative values of argc are ever allowed.
There was a problem hiding this comment.
No, we should not get a negative value.
There was a problem hiding this comment.
Checking for it now too.
MeirShpilraien
left a comment
There was a problem hiding this comment.
I think we should also check for pointer alignment, at least for argv.
I disagree it will fix the issue, it might give us a better clue where to search for the issue. The real issue is that we got a NULL or unaligned pointer from Redis. I also suspect it might be related to the sanitiser itself. |
Indeed, it won't ever fix any issues, it will solve the debug assertion and will only allow the correct code though. |
This should resolve the debug assertion and allow only safe code to continue.
This should resolve the debug assertion and allow only safe code to continue.
https://app.circleci.com/pipelines/github/RedisJSON/RedisJSON/6447/workflows/34fa491b-ece8-4dd5-a5ad-3d5c6df9e024/jobs/25181/artifacts