Skip to content

Instantly share code, notes, and snippets.

@agentzh
Created October 19, 2018 23:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agentzh/03d6f9e9137ed269cbab46d18aacd0b7 to your computer and use it in GitHub Desktop.
Save agentzh/03d6f9e9137ed269cbab46d18aacd0b7 to your computer and use it in GitHub Desktop.
commit 78c9a67ec4e487058c215136594d4bbfe6185ca0
Author: Yichun Zhang (agentzh) <yichun@openresty.com>
Date: Wed Oct 3 20:20:26 2018 -0700
bugfix: a NULL deferef crash might happen in const_folder::visit_binary_expression() due to the fact that e->tok might be NULL.
It is still not clear why e->tok would end of being NULL in the first
place. Need investigations by tracing the full stap AST with stap (or
gdb). The core dump can be easily reproduced by running the pyftrace
ylang tool with 'stap -vvv' (and also without this patch).
This patch is just a quick workaround for now.
diff --git a/elaborate.cxx b/elaborate.cxx
index 882d1f967..89dad2a7c 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -4618,7 +4618,7 @@ const_folder::visit_binary_expression (binary_expression* e)
(right->value <= 0 && (e->op == ">>" || e->op == "<<")))))
{
if (session.verbose>2)
- clog << _("Collapsing constant-identity binary operator ") << *e->tok << endl;
+ clog << _("Collapsing constant-identity binary operator ") << e->op << endl;
relaxed_p = false;
// we'll pass on type=pe_long inference to the expression
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment