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
Kill R_NOTNULL #11553
Comments
Well, as I didn't understand before what this issue was about, I analyzed the places where R_NOTNULL is used. This is what I saw:
So the question is: in those cases, what should |
Some cases load buffer return rbuffer iirc. The thing is, can we change the signature to be bool instead?
… On 19 Sep 2018, at 18:29, davidpolverari ***@***.***> wrote:
Well, as I didn't understand before what this issue was about, I analyzed the places where R_NOTNULL is used. This is what I saw:
There are different definitions of static void * load_bytes(RBinFile *bf, const ut8 *buf, ut64 sz, ut64 loadaddr, Sdb *sdb), one in each file that deals with a different bin file.
R_NOTNULL is used only as a return value to some of those load_bytes definitions.
In those cases, that function only calls static bool check_bytes(const ut8 *buf, ut64 length), which, by its turn, only returns a bool, and doesn't use all the parameters that were passed to load_bytes.
Furthermore, it doesn't make sense to return a pointer, even more a constant one, in those cases, if they are totally unrelated with the results of check_bytes.
So the question is: in those cases, what should load_bytes return? A NULL? Any other pointer will be completely arbitrary and, if used somewhere else, could lead to bad results.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
This is (void*)(size_t)-1UL, which is a bad idea and shouldnt be used at all
The text was updated successfully, but these errors were encountered: