-
Notifications
You must be signed in to change notification settings - Fork 31
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
Fix SIGSEGV in bdecode_node if the pointer is null #244
base: master
Are you sure you want to change the base?
Conversation
I will look into this problem, but this file is auto-generated, so we need to find another solution. |
I forgot that SWIG is used in the project, probably it's possible to describe the interface for code generation? |
@aldenml |
Hi @proninyaroslav still nothing, but I will look at it. |
Any updates? I've been stuck on this for so long waiting for a fix |
@aldenml |
Hi @proninyaroslav , hi :) I looked a it and got close, but concluded it could take me a non-trivial amount of time to wrap up. Still no ETA. |
@aldenml |
@aldenml
var announceNode = node.dict_find_list_ex("announce-list");
if (announceNode == null) {
return new ArrayList<>();
}
// SIGSEGV
var urls = new ArrayList<AnnounceEntry>(announceNode.list_size());
... |
Hi @proninyaroslav, I'm sorry I have unable to find some time to dedicate to this issue. I deduced a time ago that this is not a trivial issue, and I think it's related to a flaw on how SWIG generate the code for this particular structure. This is still on my TODO list. |
@aldenml |
When I try to call a method like
bdecode_node::dict_find_list_ex
and if the node is not found, then the method returns abdecode_node
object with a null pointer inside. So, if I call any method that works with a pointer (e.g.bdecode_node::list_size
) then it throws SIGSEGV:The solution is to check the pointer and return null
bdecode_node
if the pointer is null, for methodsdict_find_*_ex
,list_at
,dict_at_node
.