Created
January 27, 2020 10:45
-
-
Save dstogov/772dccdfe9c5d8ac4c8e842951d9a0cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c | |
index e1001062e5..005a877126 100644 | |
--- a/Zend/zend_execute_API.c | |
+++ b/Zend/zend_execute_API.c | |
@@ -527,10 +527,18 @@ ZEND_API uint32_t zend_get_executed_lineno(void) /* {{{ */ | |
ex = ex->prev_execute_data; | |
} | |
if (ex) { | |
- if (EG(exception) && ex->opline->opcode == ZEND_HANDLE_EXCEPTION && | |
+ if (EG(exception) | |
+ && ex->opline >= &EG(exception_op)[0] | |
+ && ex->opline <= &EG(exception_op)[3] | |
+ && ex->opline->opcode == ZEND_HANDLE_EXCEPTION && | |
ex->opline->lineno == 0 && EG(opline_before_exception)) { | |
return EG(opline_before_exception)->lineno; | |
} | |
+ if (ex->opline < ex->func->op_array.opcodes | |
+ || ex->opline > ex->func->op_array.opcodes + ex->func->op_array.last) { | |
+ /* EX(opline) may be uninitialized */ | |
+ ex->opline = ex->func->op_array.opcodes; | |
+ } | |
return ex->opline->lineno; | |
} else { | |
return 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment