-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Avoid dereference-of-casted-pointer #10760
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
Conversation
src/core_memusage.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove static cast?
return memusage::DynamicUsage(script);In my system it builds fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch, fixed.
src/wallet/walletdb.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the cast, shouldn't the compiler resolve to:
template<typename Stream, unsigned int N, typename T>
inline void Serialize(Stream& os, const prevector<N, T>& v)If not I think we could implement CScript::Serialize to call super and drop all of these casts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I somehow remembered that this didn't work, but it seems I was wrong. Fixed.
|
Concept ACK 8be4385d64c5a50c63834b75c06d1b27d66ddb62 Regarding the |
8be4385 to
0aadc11
Compare
|
tACK. |
gmaxwell
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
|
utACK 0aadc11 |
What is the rationale here? Just code cleanup? |
|
Yes, cleanup. The existing practice risks hiding some bugs. |
|
utACK 0aadc11 |
0aadc11 Avoid dereference-of-casted-pointer (Pieter Wuille) Pull request description: And prefer a static_cast to the intended reference type. Tree-SHA512: e83b20023a4dca6029b46f7040a8a6fd54e1b42112ec0c87c3c3b567ed641de97a9e2335b57a2efb075491f641e5b977bc226a474276bea0c3c3c71d8d6ac54d
0aadc11 Avoid dereference-of-casted-pointer (Pieter Wuille) Pull request description: And prefer a static_cast to the intended reference type. Tree-SHA512: e83b20023a4dca6029b46f7040a8a6fd54e1b42112ec0c87c3c3b567ed641de97a9e2335b57a2efb075491f641e5b977bc226a474276bea0c3c3c71d8d6ac54d
Signed-off-by: Pasta <[email protected]>
206a6d6 Avoid dereference-of-casted-pointer (Pieter Wuille) Pull request description: Straightforward cleanup, from bitcoin#10760 ACKs for top commit: furszy: re-utACK 206a6d6 Fuzzbawls: utACK 206a6d6 Tree-SHA512: ef36994afe9fe2fc3b9ce5f88cdc77c89617bfd642d98a3fc83cb030063cc2ebb3537dca98b23e02a341a7e64d78fd5d715ee74a72b79c6ac455ecd67e841096
And prefer a static_cast to the intended reference type.