You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know that eventually the task stuff will be rewritten in Rust but for now the file src/rt/rust_task.cpp on incoming has generally weird code in the rust_task::new_big_stack method. I found out about this by using clang's static analysis capabilities (which can be used with scan-build configure; scan-build make;)
big_stack->task = this;
big_stack->next = stk->next;
if (big_stack->next)
big_stack->next->prev = big_stack;
big_stack->prev = stk;
if (stk)
stk->next = big_stack;
In the code, stk is dereferenced to get to nxt but is then later checked at if (stk) to see if it is null. Either the line of code big_stack->next = stk->next; should be put inside a check for nullity, or there should be an assertion that stk is not null at the top of the method, and stk should not be checked at stk->next = bit_stack;
I tried to figure out the logic here but I have no experience, and so was confused. Hopefully someone else can figure out how to correct this code.
The text was updated successfully, but these errors were encountered:
This commit fixes#7022 - I've added an additional check to ensure that
stk is not null before dereferencing it to get it's next element,
assigning NULL if it is itself NULL.
I know that eventually the task stuff will be rewritten in Rust but for now the file src/rt/rust_task.cpp on incoming has generally weird code in the rust_task::new_big_stack method. I found out about this by using clang's static analysis capabilities (which can be used with
scan-build configure; scan-build make;
)Here's some of the code which I thought was weird (it starts at https://github.com/mozilla/rust/blob/incoming/src/rt/rust_task.cpp#L614 ):
In the code,
stk
is dereferenced to get tonxt
but is then later checked atif (stk)
to see if it is null. Either the line of codebig_stack->next = stk->next;
should be put inside a check for nullity, or there should be an assertion thatstk
is not null at the top of the method, andstk
should not be checked atstk->next = bit_stack;
I tried to figure out the logic here but I have no experience, and so was confused. Hopefully someone else can figure out how to correct this code.
The text was updated successfully, but these errors were encountered: