ponyc: Potential compiler segfault in lookup.c

https://github.com/ponylang/ponyc/blob/58134d152503147e7980404990252136dd7b6cc6/src/libponyc/type/lookup.c#L56-L68

This code is a bit bogus. If opt can be NULL, the declaration typecheck_t* t = &opt->check; could crash the compiler. In any case, it looks like the t declaration could be safely moved into the scope of the if-branch, where it is properly guarded against opt == NULL.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 21 (21 by maintainers)

Commits related to this issue

Most upvoted comments

@stefandd - We already have the opt here in this scope (it’s the last parameter received by add_special) so in my opinion there’s no reason to pass NULL to lookup_try - we should pass the real opt.