diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-02-12 03:17:36 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-02-17 11:07:15 +0100 |
| commit | ea23b16490c7c42cbf83cafde968ebbd78128ea4 (patch) | |
| tree | abdeaecf187b526f74986601f912ff2da28ce944 /linearize.c | |
| parent | 6a753aada1b0bc31358381d612695e0f4ac428fe (diff) | |
| download | sparse-dev-ea23b16490c7c42cbf83cafde968ebbd78128ea4.tar.gz | |
show_pseudo(): protect against NULL ->sym
When displaying a PSEUDO_SYM, the corresponding symbol is
dereferenced but it's possible that this symbol is NULL
when a type error is present.
Fix this by explicitly checking against null ->sym and
emitting "<bad symbol>" if null.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'linearize.c')
| -rw-r--r-- | linearize.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/linearize.c b/linearize.c index 3b4b0d9b..c174d631 100644 --- a/linearize.c +++ b/linearize.c @@ -111,6 +111,10 @@ const char *show_pseudo(pseudo_t pseudo) struct symbol *sym = pseudo->sym; struct expression *expr; + if (!sym) { + snprintf(buf, 64, "<bad symbol>"); + break; + } if (sym->bb_target) { snprintf(buf, 64, ".L%u", sym->bb_target->nr); break; |
