From f87fbb97ec7befa8126a929d5c4f5bdb3ace52bb Mon Sep 17 00:00:00 2001 From: Albert Huang Date: Sat, 25 Mar 2017 15:36:35 -0400 Subject: [PATCH] Fix '.echo >0' crash in first pass When run_first_pass_line / run_first_pass_line_sec changes the ptr to NULL, run_first_pass does not check for this and attempts to dereference the NULL ptr, causing a crash. Adding a NULL check and breaking out of the loops fixes this! Fixes one of the fuzzed lines in #43. --- pass_one.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pass_one.cpp b/pass_one.cpp index adfecc3..0f907af 100644 --- a/pass_one.cpp +++ b/pass_one.cpp @@ -148,6 +148,9 @@ void run_first_pass (char *ptr) { do_listing_for_line (ptr); line_num++; + } else { + // Nothing more to read, return + break; } } }