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
{{ message }}
Repository navigation
Push error onto the stack when malloc fails in scrypt #5781
Whoever fixes this issue might want to skim over the other locations where no error is pushed after a malloc failure. Maybe one or the other location deserves an error message, too. To find them, just run the following command from the OpenSSL source directory:
It would be nice if we could push the error down into the CRYPTO_alloc routines. We'd lose the function name, but we could preserve the source file/line numbers.
You mean, preserve file/line numbers of the caller, right? That sounds like a good idea. Initially, I also thought about pushing the error in CRYPTO_*alloc() itself, but then I discarded that thought because the line information of the alloc function itself would have been practically useless.
Scrypt can use substaintal amounts of memory, I think it's likely that it
may cases an error stack allocation can succeed when the scrypt allocation
failed
@bernd-edlinger : there is no allocation in ERR_put_error function. storage is allocated at startup. @mspncp : your grep is retrieving 87 occurrences ...
@bernd-edlinger : you are right, it better that the app push an error as soon as possible to init the error-storage start ERR_STATE, or call directly ERR_get_state from each thread startup.
I remenber that CRL loading trigger systematically some errors ...
May-be add a word about this in documentation ?
Activity
mspncp commentedon Mar 28, 2018
Whoever fixes this issue might want to skim over the other locations where no error is pushed after a malloc failure. Maybe one or the other location deserves an error message, too. To find them, just run the following command from the OpenSSL source directory:
richsalz commentedon Mar 28, 2018
It would be nice if we could push the error down into the CRYPTO_alloc routines. We'd lose the function name, but we could preserve the source file/line numbers.
mspncp commentedon Mar 28, 2018
You mean, preserve file/line numbers of the caller, right? That sounds like a good idea. Initially, I also thought about pushing the error in CRYPTO_*alloc() itself, but then I discarded that thought because the line information of the alloc function itself would have been practically useless.
richsalz commentedon Mar 28, 2018
Look at the define's for OPENSSL_malloc and friends, and the body of CRYPTO_malloc and friends.
Would still lose the function name tho.
mspncp commentedon Mar 28, 2018
I‘ll think about it. But for today I‘m offline now.
bernd-edlinger commentedon Mar 28, 2018
Pushing something on the error stack is likely to fail when there is no more memory left.
bernd-edlinger commentedon Mar 28, 2018
OTOH this function seems to have numerous error exits without instrumentation.
alex commentedon Mar 28, 2018
FdaSilvaYY commentedon Mar 28, 2018
@bernd-edlinger : there is no allocation in ERR_put_error function. storage is allocated at startup.
@mspncp : your grep is retrieving 87 occurrences ...
mspncp commentedon Mar 28, 2018
I know. That‘s why I didn‘t post them ;-)
bernd-edlinger commentedon Mar 29, 2018
Well @FdaSilvaYY maybe not in ERR_put_error, but look at ERR_get_state.
FdaSilvaYY commentedon Mar 29, 2018
@bernd-edlinger : you are right, it better that the app push an error as soon as possible to init the error-storage start ERR_STATE, or call directly ERR_get_state from each thread startup.
I remenber that CRL loading trigger systematically some errors ...
May-be add a word about this in documentation ?
BTW this issue is fixed in
master : 3484236
mspncp commentedon Mar 29, 2018
This issue was not closed automatically, because the commit did not contain a 'Fixes #5781' line. Never mind, I'll close it now.
DDvO commentedon May 14, 2018
Further, more general discussion on this topic has been started in issue #6251.