From: Stefan Sperling Subject: Re: diff: handle missing new lines in trailing context To: Tom Jones Cc: gameoftrees@openbsd.org Date: Thu, 29 Sep 2022 11:35:45 +0200 On Thu, Sep 29, 2022 at 10:00:37AM +0100, Tom Jones wrote: > Hi folks, > > If there is a missing new line in the context we currently miss it and > fail to print the warning. This trips up patch and leads to failures. > > This patch uses the chunk at result->chunks.head[cc->chunk.end] for > checking the final atom. I am not sure if can assume there is a chunk > there, but I haven't seen another way to access this correctly. Using chunk.end as an index will end up indexing one item beyond the end of the array. Does your test still work when checking at index chunk.end - 1 instead?