mirror of
https://github.com/QuasarApp/openssl.git
synced 2025-05-14 02:19:39 +00:00
Fix a possible crash in the error handling.
Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3672) (cherry picked from commit 4fc426b78964b3d234cb7b1b6112c9b80e16a13a)
This commit is contained in:
parent
55abd566ea
commit
8dc2e33468
@ -725,6 +725,8 @@ void ERR_put_error(int lib, int func, int reason, const char *file, int line)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
es = ERR_get_state();
|
es = ERR_get_state();
|
||||||
|
if (es == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
es->top = (es->top + 1) % ERR_NUM_ERRORS;
|
es->top = (es->top + 1) % ERR_NUM_ERRORS;
|
||||||
if (es->top == es->bottom)
|
if (es->top == es->bottom)
|
||||||
@ -742,6 +744,8 @@ void ERR_clear_error(void)
|
|||||||
ERR_STATE *es;
|
ERR_STATE *es;
|
||||||
|
|
||||||
es = ERR_get_state();
|
es = ERR_get_state();
|
||||||
|
if (es == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
for (i = 0; i < ERR_NUM_ERRORS; i++) {
|
for (i = 0; i < ERR_NUM_ERRORS; i++) {
|
||||||
err_clear(es, i);
|
err_clear(es, i);
|
||||||
@ -806,6 +810,8 @@ static unsigned long get_error_values(int inc, int top, const char **file,
|
|||||||
unsigned long ret;
|
unsigned long ret;
|
||||||
|
|
||||||
es = ERR_get_state();
|
es = ERR_get_state();
|
||||||
|
if (es == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (inc && top) {
|
if (inc && top) {
|
||||||
if (file)
|
if (file)
|
||||||
@ -1066,6 +1072,8 @@ void ERR_set_error_data(char *data, int flags)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
es = ERR_get_state();
|
es = ERR_get_state();
|
||||||
|
if (es == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
i = es->top;
|
i = es->top;
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
@ -1121,6 +1129,8 @@ int ERR_set_mark(void)
|
|||||||
ERR_STATE *es;
|
ERR_STATE *es;
|
||||||
|
|
||||||
es = ERR_get_state();
|
es = ERR_get_state();
|
||||||
|
if (es == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (es->bottom == es->top)
|
if (es->bottom == es->top)
|
||||||
return 0;
|
return 0;
|
||||||
@ -1133,6 +1143,8 @@ int ERR_pop_to_mark(void)
|
|||||||
ERR_STATE *es;
|
ERR_STATE *es;
|
||||||
|
|
||||||
es = ERR_get_state();
|
es = ERR_get_state();
|
||||||
|
if (es == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
while (es->bottom != es->top
|
while (es->bottom != es->top
|
||||||
&& (es->err_flags[es->top] & ERR_FLAG_MARK) == 0) {
|
&& (es->err_flags[es->top] & ERR_FLAG_MARK) == 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user